how to save data of lots of images individually?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jialin Men
le 31 Mar 2023
Commenté : Jialin Men
le 18 Juil 2023
Hallo everyone,
I would like to ask you a question about how to savel the datas individually after processing all the images.
I have already use the code here to run all the images from one folder automatically. now I could save all the datas of all the processing images and then make plots like, area distirbution, but this is for all the data together, now i would like to do is after i process the first image, then i get the first area distribution for first image, then second and so on.
I try to use the loop,
for k = 1 : length(theFiles)
baseFileName = theFiles(k).name;
fullFileName = fullfile(theFiles(k).folder, baseFileName);
data(k)=Areas;
fprintf(1, 'Now reading %s\n', fullFileName);
but it does not work.
Thanks in advance
JL
0 commentaires
Réponse acceptée
Image Analyst
le 2 Avr 2023
You need to index the data variable with the loop variable, like
for k = 1 : numImages
data(k) = whatever;
end
Then you can display them however you like, for example plot data, or write data to a text file and open it up, or write data to an Excel workbook.
2 commentaires
Image Analyst
le 12 Juil 2023
Regarding your edit today, you added (k) to the data assignment, which is fine if "Areas" is a scalar. But you don't say how you got it and because it's plural, I'm guessing that it's a vector of several values, not one single scalar. In that case it would throw and error unless data was a 2-D matrix with as many columns as Areas had. Attach your complete script if you want more help, but after you read this:
Plus de réponses (1)
Walter Roberson
le 31 Mar 2023
Initialize a cell array the size of the number of images in the folder. As you go through and produce results, assign the result into the appropriate entry in the cell array.
Note: if the output for each image is exactly the same size, then it can be more space efficient to use a 3 or 4 dimensional array to store the results -- but whether it is more time efficient depends in part on what you are doing with the information.
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!