Limiting the columns of an array.

I have a couple of vectors and arrays that are being used in mathematical calculations but unfortunately their dimensions wont seem to match up.
Three of the dimensions are 1 X 401 whilst one of them is 1 X 402. The longer dimension has 0 as its last value and it is not needed later in my code. Is there any command I can use to limit the columns that data is pumped out into? Potentially just something that I can use to cut off that last value after they come out of an equation before it is used in another equation where it has to match 1 X 401?
Thanks very much!!!
Joe

 Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 7 Dec 2014
Edited: Azzi Abdelmalek on 7 Dec 2014
a=rand(1,402)
b=a(1,1:401)
%or
a(402)=[]

2 Comments

Doesn't this effect the data itself rather than the columns used to gather the data? To clarify, I only want to use the first 401 columns. :)

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!