how can i prelocate arrays
1 次查看(过去 30 天)
显示 更早的评论
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/238823/image.png)
2 个评论
James Tursa
2019-9-19
编辑:James Tursa
2019-9-19
Please edit your question and post your code as text formatted with the CODE button. We cannot copy & paste pictures into MATLAB to try out your code. My guess is that u is a variable and not a function, so using t(i) in the indexing may be the cause of the problem.
John D'Errico
2019-9-19
Yes. I think you are correct. The obvious problem is if u is a variable, are the terms like (u(t(i) + pi)). t(i) + pi will never be an exact integer.
回答(1 个)
SaiDileep Kola
2019-9-23
Pre allocating arrays may not solve your problem, as the error msg states you are indexing array ”u” using either negative integers or fractions, check if “t(i)-3” value turns out to be a negative or fraction.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!