Borrar filtros
Borrar filtros

How do I combine vectors to form a matrix?

2 visualizaciones (últimos 30 días)
Franchesca
Franchesca el 14 de Mayo de 2014
Respondida: Andrei Bobrov el 14 de Mayo de 2014
I am trying to run a loop which puts column 5 from every cell in this array shown below into a new matrix:
This is my code at the moment:
combined = [6050,54]
for i=1:length(mydata)
combined(:,i) = mydata{i,1}(:,5);
end
This is the error I recieve:
Subscripted assignment dimension mismatch.
Error in MatlabCoursework (line 84) combined(:,i) = mydata{i,1}(:,5);

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 14 de Mayo de 2014
combined = cell2mat(cellfun(@(x)x(:,5),mydata,'un',0));

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements 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