03-16-2010 03:10 PM
If I have a 1D DBL array, how can I set the first and last (e.g.) 100 values to, say, 0?
I can think of doing a for loop for both the first and last segments, but wonder if there's a more elegant way.
Solved! Go to Solution.
03-16-2010 03:19 PM
Hi ap8888,
you can initialize an array with 100 elements of 0. Use the replace array subset function to replace the data from your array with the initialized elements.
Mike
03-16-2010 03:55 PM - edited 03-16-2010 03:59 PM
Thanks.
But how do I replace elements 1 through 100? In MATLAB I would likely type, A(1:100)=0.
Moreover how do I set the last 100 to 0?
In other words I don't want to push my data over to fit the new 100. I want to replace.
03-16-2010 04:00 PM
03-16-2010 04:03 PM
03-16-2010 04:08 PM - edited 03-16-2010 04:08 PM
03-16-2010 04:15 PM