How can I create a .mat file in which I store the colour images and the corresponding histograms?

radha · Aug 30, 2022 · 2.3K views
Question
I want to create the .mat file in which I need to store the Colour images and corresponding each colour image I need to store 4 histograms in row form. Can any one help me with code how to store color image and corresponding histogram in row form?    
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Aug 23, 2026

Make a 2D array of 1024 column by 50 rows

 

 

output = zeros(totalNumberOfImages, 1024); % Initialize
for imageNumber = 1 : totalNumberOfImages
  % Compute the 4 histograms...
  % Now save them
  output(imageNumber, :) = [count1, count2, count3, count4];
endM

do for all images, then save output (or whatever you want to call it) to a mat file

save(matFullFileName, 'output');

 

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!