series with empty entrys

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

Antworten (2)

Azzi Abdelmalek
Azzi Abdelmalek am 21 Mai 2014

0 Stimmen

a={1;2;3}
a(end+1:end+2)={[]}

1 Kommentar

Linden
Linden am 21 Mai 2014
Thanks Azzi. But this would not go with my series because the series is in double.

Melden Sie sich an, um zu kommentieren.

Jos (10584)
Jos (10584) am 21 Mai 2014
Bearbeitet: Jos (10584) am 21 Mai 2014

0 Stimmen

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

Gefragt:

am 21 Mai 2014

Bearbeitet:

am 21 Mai 2014

Community Treasure Hunt

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

Start Hunting!

Translated by