Borrar filtros
Borrar filtros

How to label a structure name in a loop

5 visualizaciones (últimos 30 días)
Regan Kubicek
Regan Kubicek el 3 de Oct. de 2022
Respondida: Chunru el 3 de Oct. de 2022
I've created a cell called low that has structures (t1, t2, t3.....) I would like to change the 1,2,3 in a for loop
what works manually.....
data = (low{1}.t1(:,1))
what I want looping
for i=1:5
data = (low{1},t'i'(:,1))
end

Respuestas (1)

Chunru
Chunru el 3 de Oct. de 2022
low.t1 = 2;
low.t2 = 3;
for i=1:2
data = low.("t"+i)
end
data = 2
data = 3

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by