Simple operations with struct
Mostrar comentarios más antiguos
How to exclude elements of a struct with a value less than a limit?
For example, if a struct has only one field and this field has the values 220000 and 40000. How to exclude (make 0) only the values less than 50000?
1 comentario
Image Analyst
el 11 de Jun. de 2020
Original question before it gets edited away:
How to exclude elements of a struct with a value less than a limit?
For example, if a struct has only one field and this field has the values 220000 and 40000. How to exclude (make 0) only the values less than 50000?
Respuesta aceptada
Más respuestas (1)
David Hill
el 5 de Abr. de 2020
yourStuck.field(yourStuck.field<50000)=0;
1 comentario
Ameer Hamza
el 5 de Abr. de 2020
David, this syntax is not supported in MATLAB
s(1).a = 1;
s(2).a = 2;
s(3).a = 3;
s(4).a = 4;
s.a(s.a < 3) = 0;
Error using <
Too many input arguments.
Error in Test (line 6)
s.a(s.a < 3) = 0;
Categorías
Más información sobre Structures en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!