Save values of variable inside loop
显示 更早的评论
Can anyone help me to save values of 'hFMar10(k)', where k is 31 times iteration. So I will have a file that contain [hFMar10(1), hFMar10(2), hFMar10(3),.......,hFMar10(31)] Below is my code :
load CP_Max10;
x=[1:1:186];
%Max from raw data directly
y1=CP_Max10(:,1);
NData1=length(y1);
k=0;
figure(1);
for n=1:6:NData1
k=k+1;
hFMar10(k)=plot(y1(n:n+5), 'linewidth',2);
hold on
end
4 个评论
Walter Roberson
2016-11-16
When you say that you want to sae them to a file: are you aware that what they contain is graphics handles of line objects? Typically you do not want to save graphics handles to a file (there are some cases where you want to though.)
Are you trying to save the graphics handles to a file, or are you trying to save 31 individual drawings with axis and all, as an image, or are you trying to save a single image that has 31 lines in it, or ...?
Martiningrum Dyah Rahayu
2016-11-16
KSSV
2016-11-16
All ready they are saved in CP_Max10. Why you want to save them again?
Martiningrum Dyah Rahayu
2016-11-16
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!