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

 채택된 답변

Ameer Hamza
Ameer Hamza 2018년 5월 5일

1 개 추천

You need to index into Cell array C.
A{j} = B{j}(:, C{j});
In your code, to used C as the index itself.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2018년 5월 5일

댓글:

2018년 5월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by