MATLAB Answers

0

making array in for loop

Asked by Kangkeon Jeon on 8 Nov 2019 at 2:19
Latest activity Commented on by Kangkeon Jeon on 8 Nov 2019 at 8:25
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 Comments

Shubham Gupta on 8 Nov 2019 at 2:39
Alignment should be a cell type array to use
Alignment{k} % notice curly paranthesis, it is used cell type arrays.
Kangkeon Jeon on 8 Nov 2019 at 8:25
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

Sign in to comment.

1 Answer

James Tursa
Answer by James Tursa
on 8 Nov 2019 at 2:42
 Accepted Answer

Maybe prior to the loop define Alignment as a cell array to hold your results:
Alignment = cell(10000,1);

  1 Comment

Shubham Gupta on 8 Nov 2019 at 4:33
But using this means, losing the original data of Alignment which is a char array of (3x158)?

Sign in to comment.