How to convert cell to matrix
Mostrar comentarios más antiguos
I have a 100001x2 cell. Each cell is 1x1.
How can I convert it to matrix? I've tried cell2mat but I can't make it work
5 comentarios
Jon
el 10 de En. de 2022
You don't provide enough detail for anyone to figure out how to help you with your problem. Please provide a self contained example, that reproduces the problem, and also let us know exactly what error messages you are getting
Torsten
el 10 de En. de 2022
We can't tell - usually it should work with cell2mat. Are you sure each cell contains a numeric value ? Can you share your code for testing ?
Manuela Maria ALAMPI
el 10 de En. de 2022
Matt J
el 10 de En. de 2022
The code you've shown does not produce a 100001x2 cell array. You should attach the cell array dirctly in a.mat file so that we can avoid the steps of generating it.
Image Analyst
el 10 de En. de 2022
ca = signal.textdata([6:end],[1,2]);
save('answers.mat', 'ca');
Then attach answers.mat with the paperclip icon.
Respuesta aceptada
Más respuestas (2)
cell2mat should have worked
A=num2cell(rand(100001,2)); whos A
B=cell2mat(A); whos B
Simon Chan
el 10 de En. de 2022
Try this, where A is your 100001x2 cell:
cell2mat(cellfun(@(x) x,A))
1 comentario
Manuela Maria ALAMPI
el 10 de En. de 2022
Categorías
Más información sobre Data Type Conversion 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!