How to save each and every output of if statement and else statement used in for loop??? How to access the saved values for further assisstance
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
KALYANAPU SRINIVAS
el 28 de Nov. de 2018
Respondida: KALYANAPU SRINIVAS
el 13 de Dic. de 2018
Ne=16;
for ii = 1:Ne
enc_x(ii+1) = r*enc_x(ii)*(1 - enc_x(ii));
enc_y(ii+1) = r*enc_y(ii)*(1 - enc_y(ii));
if (enc_x(ii)>enc_y(ii))
fprintf('Iterrations No %i ',ii);
fprintf('%d',0);
fprintf('\n');
else
fprintf('Iterrations No %i ',ii);
fprintf('%d',1);
fprintf('\n');
end;
end
2 comentarios
Respuestas (2)
KSSV
el 28 de Nov. de 2018
iwant = zeros(1,10) ;
for i = 1:10
x = rand ;
if x<0.5
iwant(i) = x-0.5 ;
else
iwant(i) = x+0.5 ;
end
end
2 comentarios
Ver también
Categorías
Más información sobre Shifting and Sorting Matrices 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!