series with empty entrys

2 次查看(过去 30 天)
Linden
Linden 2014-5-21
Hi I have a series (double) with the demension of 61x1. I want to enlarge it to 63x1 with the last two values to be empty. How can I do this? Many thanks

回答(2 个)

Azzi Abdelmalek
Azzi Abdelmalek 2014-5-21
a={1;2;3}
a(end+1:end+2)={[]}
  1 个评论
Linden
Linden 2014-5-21
Thanks Azzi. But this would not go with my series because the series is in double.

请先登录,再进行评论。


Jos (10584)
Jos (10584) 2014-5-21
编辑:Jos (10584) 2014-5-21
Each element in a double array has to be set to something. It cannot be empty.
You can use NaN (or maybe also zero) as a place-holder to make the array having a particular size
A = 1:3
B = 10:10:50
% Now, I want A to have two extra elements, because B has
% 5 elements, and I want to add each element of A to the
% corresponding element of B
A(4:5) = NaN
C = A + B

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by