For loop to iterate over cell data and graph it
4 次查看(过去 30 天)
显示 更早的评论
Issue: For loop does not iterate over the entire cell array which I unfortunately can't attach because of how big it is. I am not entirely sure how to fix it, but I feel like the issue might be within the placement of the loop counter. However, even after moving it around, it only shows the 1st or 63rd trial. I don't want to concatenate because if figuring this for loop out would save a lot of time for the rest of the data analysis. Any input would be greatly appreciated.
n = 1;
figure(4),cla
for i = n
plot(hEMcell{n},vEMcell{n},'k')
title('All Trials')
axis tight
axis square
n=n+1;
hold on
end
0 个评论
采纳的回答
Adam Danz
2018-7-30
编辑:Adam Danz
2018-7-30
A for-loop usually operates on a vector of 'i' values whereas you are only looping once
for i = n %where n = 1
You can add n = n+1 but that won't change the fact that the for-loop is already satisfied at the end of the first iteration.
It's not clear how many iterations you expect. If you're looping over every element of 'hEMcell', get rid of 'n' and do this
for i = 1:length(hEMcell)
...
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!