fill matrix from cell matrix
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Targh dadou
el 5 de Mayo de 2018
Comentada: Targh dadou
el 5 de Mayo de 2018
HELLO,
I have a cell matrix B (1 * 67 cell), each cell contains a matrix of type N * N C is a cell matrix of type 1 * 67 cell, each cell contains a matrix of type 1 * M I want to fill A from B by respecting the column number indicated in C
for j=1:67
A{j}=B{j}(:,C);
end
error Function 'subsindex' is not defined for values of class 'cell
EXEMPLE for a cell of the matrix
B'=
1 5 3 4 5 6 9 1
4 5 6 7 8 9 8 9
7 8 9 6 5 4 1 2
9 8 7 6 5 4 5 6
1 2 3 4 5 6 1 2
9 8 7 6 5 4 2 3
7 5 8 8 6 9 7 8
C'= 2 7 8
So A'=
5 9 1
5 8 9
8 1 2
8 5 6
2 1 2
8 2 3
5 7 8
I'm trying to convert the cell matrix into a table matrix
Tabl= cell2table(B);
Ta = cell2table(C);
A=Tabl(:,Ta);
error using "Table variable subscripts must be real positive integers, logicals, strings, or cell arrays of strings."
Do you have an idea
thank you in advance
0 comentarios
Respuesta aceptada
Ameer Hamza
el 5 de Mayo de 2018
You need to index into Cell array C.
A{j} = B{j}(:, C{j});
In your code, to used C as the index itself.
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays 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!