how convert string in struct with 0/1
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
aldo
el 3 de Nov. de 2023
Respondida: Stephen23
el 3 de Nov. de 2023
>> class(Sis)
ans =
'struct'
>> size(Sis)
ans =
1 351
i access it using : Sis(1).FilterSkip
Sis.FilterSkip can to be "No" or "Si" or "Rank"
if Sis.FilterSkip ="No" i want to get 0.
.if Sis.FilterSkip="Si" i want to get 1
i want to create vector wih 0 or 1 using Sis.FilterSkip
2 comentarios
Respuesta aceptada
Stephen23
el 3 de Nov. de 2023
S = struct('FS',{'Si','No','Si','Rank','No'})
Z = nan(size(S));
[X,Y] = ismember({S.FS},{'No','Si'});
Z(X) = Y(X)-1
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Structures en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!