Borrar filtros
Borrar filtros

How can I store this data?

1 visualización (últimos 30 días)
Elliott Fullerton
Elliott Fullerton el 24 de Oct. de 2017
Editada: Jan el 24 de Oct. de 2017
Mset is a 511x54 double and i would like to store the true or false statement for each iteration. Any advice would be much appreciated.
L=zeros(511,54);
for i=1:511
for j=1:54
if Mset(i,j)==1
L(i,j)='True';
else
L(i,j)='False';
end
end
end

Respuestas (2)

KSSV
KSSV el 24 de Oct. de 2017
L=Mset==1
You don't need a loop for that. Your L will be a logical now.
  1 comentario
Elliott Fullerton
Elliott Fullerton el 24 de Oct. de 2017
Thank you KSSV, but I still need 1's to be 'True' and 0's to be 'False' if that makes sense.

Iniciar sesión para comentar.


Jan
Jan el 24 de Oct. de 2017
Editada: Jan el 24 de Oct. de 2017
L = cell(511,54);
L(:) = {'False'};
L(MSet==1) = {'True'};
Or:
Pool = {'False', 'True'};
L = Pool((MSet == 1) + 1);

Categorías

Más información sobre Loops and Conditional Statements 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