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!

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 12월 25일
편집: KALYAN ACHARJYA 2019년 12월 25일

0 개 추천

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

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

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2019년 12월 25일

편집:

2025년 1월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by