Save data from a for loop in the same file
Show older comments
In the following code, with a for loop , I want to save all the values of T in the same file, actually it save each value in a different file. T is inside a for loop. I want the values in the same file to process it, thanks!
clear all; close all;
im_geo=imread('background.jpg');
figure; imshow(im_geo), title('background'); % Background
hold on
im_geoo=imread('signal imatge ac 15052014.jpg');
figure; imshow(im_geoo), title('bright line'); % Bright line
z=1;
x= linspace(0, 35, 35);
%totes les línies de la imatge
for p=170:1:350;
z=z+1; %eix x
%valors I
t=im_geoo(p:p,271:306);
u=im_geo(p:p,271:306);
tu=t-u;
%fwhm
mi= min(tu); ma= max(tu);
x_above= x(tu> (ma- mi)/ 2);
fwhm= x_above(end)- x_above(1);
%paràmetres
a=atan(69./(2.*570));
mmpx=5./102;
m=fwhm.*mmpx;
T=(sqrt(2).*a.*m)./(3e11);
name = num2str(p) ;
filename = mat2str([name '.txt']);
save(filename, 'T', '-ascii','-double','-append');
%plot (z,T)
%hold on
end
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!