Array question
1 次查看(过去 30 天)
显示 更早的评论
Hey every1,
I am trying to shift content of one array starting from i = 2; a[i] = b[i-d)
so I created for loop.. for i = 2:10 a[i]= b[i-d].. Its actually putting the content there starting from index 2 so I wanted when I plot it to discard a[1] and just start from a[2]. In matlab workspace the content is correct so my for loop is right but a[1] is still there and I want to shift to just be discarded ???
Thanks in advance
0 个评论
采纳的回答
Oleg Komarov
2011-7-26
idx = 2:10
a = b(i-d);
2 个评论
Oleg Komarov
2011-7-26
When you say discard I understand:
a(1) = []; % or equivalently a = a(2:end);
If you want to to preserve the size of a keeping a(1) but you want to miss the point in the plot you can put a NaN there:
a(1) = NaN;
更多回答(1 个)
the cyclist
2011-7-26
It is not perfectly clear to me what you want, but maybe something like this?
for i=2:10
a(i-1) = b(i-d)
% ...
end
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!