calling another matrix in a matrix

3 Ansichten (letzte 30 Tage)
Atakan Ekiz
Atakan Ekiz am 22 Dez. 2020
Bearbeitet: James Tursa am 22 Dez. 2020
I have lots of matrices in my code and in the end ı took minimum values of these matrices which are called yakit_x(x=1:5). Now I need to replace them with conditions I decided to 1 number lower matrix but I dont know how to put it in the code.
like yakit_3 to yakit_2
for i=1:1801
if n_cevrim(i,1)<1500
yakit_cevrim(i,1)=yakit_(vites(i,1)-1);
end
end
I tried as "yakit_vites(i,1)-1" // "yakit_'vites(i,1)-1' " // "yakit_(vites(i,1)-1)" and they didnt work.
  1 Kommentar
Image Analyst
Image Analyst am 22 Dez. 2020
So do yo have 5 arrays called yakit_1, yakit_2, yakit_3, yakit_4, and yakit_5?
And I don't know what this means "replace them with conditions I decided to 1 number lower matrix". Please explain.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

James Tursa
James Tursa am 22 Dez. 2020
Bearbeitet: James Tursa am 22 Dez. 2020
Don't do this! Creating numbered named variables in your code like yakit_1, yakit_2, etc. leads to downstream coding problems as you have discovered. Instead, use structures or cell arrays or multi-dimensional variables, which will be easy to use. E.g., see this link:

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by