Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: saving the variables in for loop

$
0
0
Hi Raghda,

Some people in this newsreader have an allergy against the function eval, but you can do this:

for i=1:26
     imFilename = sprintf('DB/%d.jpg', i);
     eval(['[im' num2str(i) ', des' num2str(i) ', loc' num2str(i) '] = sift(imFilename,i);'])
end

Best.

"raghda " <zezo.abeer@yahoo.com> wrote in message <ka0htc$m14$1@newscl01ah.mathworks.com>...
> plz i have this code
> for i=1:26
> imFilename = sprintf('DB/%d.jpg', i);
> [im , des , loc ] = sift(imFilename,i);
> end
> and i need for each iteration , the output is saved likes "im1 des1 loc1 for the first saved file and im2 des2 loc2 for the secon saved file... " by function save ('filename.mat') but i need it for each "i"

Viewing all articles
Browse latest Browse all 19628

Trending Articles