how to convert cell array to a matrix?

2 visualizaciones (últimos 30 días)
Zara Khan
Zara Khan el 30 de Jul. de 2018
Comentada: Jos (10584) el 1 de Ag. de 2018
I have a 5X4 matrix whose each element is a cell array. how to convert it to a simple matrix of elements.
  5 comentarios
Zara Khan
Zara Khan el 30 de Jul. de 2018
I want to access this matrix as row by row
Zara Khan
Zara Khan el 31 de Jul. de 2018
Bhowmik U: No its not working as we cant use cell for cell arrays.

Iniciar sesión para comentar.

Respuestas (1)

Jos (10584)
Jos (10584) el 30 de Jul. de 2018
A = {[1 2 3],[4 5],6 ; [11 12],13,[] ; 21, [22 23], [24 25]} % data
B = arrayfun(@(k) cat(2,A{k,:}),1:size(A,1),'un',0) % make row vectors
C = padcat(B{:}) % pad vectors with NaNs
  6 comentarios
Zara Khan
Zara Khan el 31 de Jul. de 2018
yes that can be done using the above code. But what about when I am storing values from loops?
Jos (10584)
Jos (10584) el 1 de Ag. de 2018
This is all rather vague ... Can you show us some code, showing where you get stuck?

Iniciar sesión para comentar.

Categorías

Más información sobre Convert Image Type 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