Problems with time travel. A (t)=Variable(t-2)
显示 更早的评论
I want to make one value of a variable in a for loop dependent on the value of another variable 2 timesteps ago.
When I am on t=1, the code will lookup Variable(-1) which is an invalid index number because array index numbers must start at 1.
Is there a way to say?
if variable(x) has an invalid reference number do y?
Can you please give me an example?
1 个评论
Azzi Abdelmalek
2012-11-2
编辑:Azzi Abdelmalek
2012-11-2
what is the value of y(-1). give an example
回答(2 个)
Azzi Abdelmalek
2012-11-2
编辑:Azzi Abdelmalek
2012-11-2
eg
y=[0 rand(1,20)]
use
y(max(1,n-n0))
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!