How to convert one row of a table to a vector?

Now I have a table and I want to convert one row to a vector. I firstly used table2array, then cell2mat. However the result is a string rather than a vector. As shown in the picture. How can I complete the transformation? Thanks!

 Respuesta aceptada

Yujian Wu
Yujian Wu el 13 de En. de 2018

0 votos

I'm sorry, this is the right method. As all the data of my first row are '0', so the converted array look like a string of 0. After changing the data type, I can get the vector of num.

2 comentarios

per isakson
per isakson el 13 de En. de 2018
Editada: per isakson el 13 de En. de 2018
What "this is the right method" ?
tbl = array2table( magic(5) );
row = tbl{ 2, : }
returns
row =
23 5 7 14 16
Yujian Wu
Yujian Wu el 13 de En. de 2018
Thank you! The right method means the two steps in my question: table2array then cell2mat.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 13 de En. de 2018

Comentada:

el 13 de En. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by