Info
This question is closed. Reopen it to edit or answer.
Output of For-loop in 1 file
1 view (last 30 days)
Show older comments
I have a for-loop for 5 measurements. The first time it runs I get the output for the first measurement. The second time it runs, I get the output for the second measurement. But the output for the first measurement disappears. I know I need to save, but I want to see all the outputdata into 1 file. In 5 columns next to each other. How do I do this?
for i_testen=1:length(data_stair_rise)
RANK = data_stair_rise(1,i_testen).VideoSignals(:, strcmp('RANK', data_stair_rise(1, i_testen).VideoSignals_headers))
RANK = abs(RANK)
figure;
plot(RANK, 'g', 'LineWidth', 2);
ylabel('Distance');
xlabel('Datapoint');
title('Walking stairs', 'FontSize', 16);
legend({'Right ankle'})
xy = ginput(2);
xy(1,1) = 0;
Afstand_1schrede = xy(2,2)-xy(1,2);}
end
I want to save 'Afstand_1schrede' in 1 file with five columns (representing the 5 measurements op 1 subject).
0 Comments
Answers (1)
Geoff Hayes
on 19 Dec 2014
Edited: Geoff Hayes
on 20 Dec 2014
Sam - you need to use Afstand_1schrede as an array rather than a scalar. Try the following
% create the 1x5 array
Afstand_1schrede = zeros(1,length(data_stair_rise));
for i_testen=1:length(data_stair_rise)
% etc.
% save the measurement
Afstand_1schrede(1,i_testen) = xy(2,2)-xy(1,2);
end
2 Comments
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!