New variables in a loop

Hello everyone! I'm facing some issues while trying to create new variables inside a loop. Can I load my data using a for loop while keeping first character (m)?
Thanks in advance!

Respuestas (1)

KALYAN ACHARJYA
KALYAN ACHARJYA el 25 de Dic. de 2019
Editada: KALYAN ACHARJYA el 25 de Dic. de 2019

0 votos

Considering the array or cell array is best way rather than assigning new variable in each iteration.
Fs=zeros(1,35);
for i=1:35
Fs(i)=L(i)/tmax(i); % assuming L and tmax both are scalars
end
% Assuming L and tmax both are scalars, if not then
Fs=cell(1,35);
for i=1:35
Fs{i}=L(i)/tmax(i);
end

2 comentarios

Ancalagon8
Ancalagon8 el 25 de Dic. de 2019
i get message: Undefined function 'L' for input arguments of type 'double'.
KALYAN ACHARJYA
KALYAN ACHARJYA el 25 de Dic. de 2019
It's your code, I have just modified, what is L? Please define.

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 25 de Dic. de 2019

Editada:

el 6 de En. de 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by