ho can i convert a structure to a matrix?

129 visualizaciones (últimos 30 días)
Joseph
Joseph el 23 de Jul. de 2015
Comentada: Walter Roberson el 25 de Sept. de 2020
ho can i convert a structure to a matrix?

Respuesta aceptada

Walter Roberson
Walter Roberson el 23 de Jul. de 2015
cell2mat(struct2cell(YourStructure))
  3 comentarios
Jacqueline Kelly
Jacqueline Kelly el 25 de Sept. de 2020
What if the cells aren't of the same data type? I have some strings and some numbers
Walter Roberson
Walter Roberson el 25 de Sept. de 2020
struct and cell are different datatypes; you need to be clear as to which you are working with for this purpose.
If you have a mix of strings and numbers, then what is your hope as to the datatype of the final matrix ? You can only combine strings and numbers in a single object if it is one of the composite datatypes such as struct, cell, or table.

Iniciar sesión para comentar.

Más respuestas (1)

muhammed boztoprak
muhammed boztoprak el 30 de Mayo de 2019
Really great answer!!! Thank you very much.

Categorías

Más información sobre Characters and Strings 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!

Translated by