The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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


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);


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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.