# Changing part of a name of a variable in a for loop

changing part of a name of a variable in a "for" loop

hello everyone!

let's say i have the equation between two variables: DT10sec= A*T10sec, working in matlab. How can i use a "for" loop to calculate the equation DT20sec= A*T20sec DT30sec= A*T30sec, DT40sec= A*T40sec,... etc

How can i interfere in just a part of the name of a variable? i would suppose something like the following

for i=1:5
DT"i"sec= A* T"i"sec
end

but it is not the right symbol

Related MATLAB, Maple, Mathematica, LaTeX News on Phys.org
mfb
Mentor

I would use an array. I don't know the matlab syntax, but most programming languages would write this as DTsec or (with a variable i) DTsec[10*i].

I would use an array. I don't know the matlab syntax, but most programming languages would write this as DTsec or (with a variable i) DTsec[10*i].
DT..sec and T..sec are matrices and i m not interested on making an array of matrices. DT is the result from calculations (as T is a known matrix) for different time points and i just want to name my results according to the time point they refer to. But i am looking for a quicker way to do it, using a for loop. Thanks anyway