making array in for loop

조회 수: 2 (최근 30일)
Kangkeon Jeon
Kangkeon Jeon 2019년 11월 8일
댓글: Kangkeon Jeon 2019년 11월 8일
for k = 1:10000
[Score(k), Alignment{k}] = nwalign(p546ref,newones{k});
find_start_stop(Alignment);
find_every_deletion(Alignment);
end
this has "Unable to perform assignment because brace indexing is not supported for variables of this type." error. Why is that?
Score is integer and Alignment is 3x158 char array.
  댓글 수: 2
Shubham Gupta
Shubham Gupta 2019년 11월 8일
Alignment should be a cell type array to use
Alignment{k} % notice curly paranthesis, it is used cell type arrays.
Kangkeon Jeon
Kangkeon Jeon 2019년 11월 8일
but i don't want to do Alignment(k), because every time i run that code, it should give 10 different Alignment of 3x158 char. I want the whole 3x158 char, not each character within one Alignment

댓글을 달려면 로그인하십시오.

채택된 답변

James Tursa
James Tursa 2019년 11월 8일
Maybe prior to the loop define Alignment as a cell array to hold your results:
Alignment = cell(10000,1);
  댓글 수: 1
Shubham Gupta
Shubham Gupta 2019년 11월 8일
But using this means, losing the original data of Alignment which is a char array of (3x158)?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by