How to export data from an image histogram to an Excel file

6 views (last 30 days)
I calculate an image histogam using this code:
a=imread('mypic.jpg');
b=rgb2gray(a);
[count,x] = imhist(b);
Now, I'd like to export the values of 'count' and 'x' to 2 separate columns in an Excel speadsheet. Please help!
Thank in advance!

Accepted Answer

Walter Roberson
Walter Roberson on 13 Oct 2023
Edited: Walter Roberson on 13 Oct 2023
T = table(x, count, 'VariableNames', {'Pixel Value', 'count'});
writetable(T, 'NameOfTheSpreadsheetGoesHere.xlsx');

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!