MATLAB Answers


making array in for loop

Kangkeon Jeon さんによって質問されました 2019 年 11 月 8 日
最新アクティビティ Kangkeon Jeon さんによって コメントされました 2019 年 11 月 8 日
for k = 1:10000
[Score(k), Alignment{k}] = nwalign(p546ref,newones{k});
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
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 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

サインイン to comment.

1 件の回答

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
2019 年 11 月 8 日
But using this means, losing the original data of Alignment which is a char array of (3x158)?

サインイン to comment.

Translated by