Different For Loop Comparison
显示 更早的评论
Does anyone can tell me is the output for this two loops is it the same? For my knowledge, the bits arranged are quite different in two case. will the bits differ in arrangement causes the file to be corrupted?
1) Without Preallocation send_count=1;
E=[];
for i=1+5000*(send_count-1):5000*send_count
E=[E F((-15+16*(i)):16*(i))];
end
2)Preallocation
send_count=1;
Idk=(1+5000*(send_count-1)):(5000*send_count);
C=zeros(16,(5000*looptimes));
for i=1:length(Idk)
C(:,i)=F((-15+16*(Idk(i))):16*(Idk(i)));
end
C=char(C);
send_count=1+send_count;
Does this give the same result?Actually I have tested it the bits arrangement using reshape are quite different. I m wondering will this cause the program to hang?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 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!