Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Save matrix in a loop
Replies: 1   Last Post: Jul 15, 2013 10:38 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
shazwani kamarudin

Posts: 1
Registered: 7/15/13
Save matrix in a loop
Posted: Jul 15, 2013 4:07 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

hello~

this is my code to segment all images in testing folder..the problem is,i want to save each matrix data in different .mat file using a loop..i dont know how to do it

clear all
srcFiles = dir('\MSc AIA\amazon images\1-1000\testing\*.jpg');
for i = 1 : length(srcFiles)

filename = strcat('\MSc AIA\amazon images\1-1000\testing\',srcFiles(i).name);
I = imread(filename);
level = graythresh(I);
BW = im2bw(I,level);
pathname = '\MSc AIA\amazon images\1-1000\testing\segmented';
segment = sprintf('%d.bmp', i);
fullfilename = fullfile(pathname, segment);
imwrite(BW, fullfilename);

end



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.