Save values of variable inside loop
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Martiningrum Dyah Rahayu
el 16 de Nov. de 2016
Comentada: Martiningrum Dyah Rahayu
el 16 de Nov. de 2016
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 comentarios
Respuesta aceptada
KSSV
el 16 de Nov. de 2016
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);
iwant{k} = max(y1(n:n+5)) ;
hold on
end
if size of CP_Max10 is known, the desired value can be initialized. You have maximum values in a cell array iwant. This can be saved using save. doc save.
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!