How to delete previous values recorded?
11 views (last 30 days)
Show older comments
hello, it would be of great help if anybody could tell me how to delete previous values recorded by matlab once my loop has reached the value that i needed it to, therefore having a new set of values, because my program is just recording all the values, inclusive the non-desired values and then plotting them, this way reducing accuracy in the graph visual because it is must larger and over a large space of time. thanks in advance luis
0 Comments
Accepted Answer
the cyclist
on 10 Apr 2013
It is not perfectly clear to me what you mean. You might want to show us some code. However, here is a guess at what you want:
Suppose you have a vector A of length 102, and you only want to keep the first 100 elements. Each of the following methods would work:
A = A(1:100);
or
A(101:102) = [];
or
A(end-1:end) = [];
More Answers (1)
Image Analyst
on 10 Apr 2013
To delete an entire variable:
clear('yourArray', 'yourOtherArray');
to delete just some indexes:
indexesToDelete = 4:10; % or whatever.
yourArray(indexesToDelete) = [];
0 Comments
See Also
Categories
Find more on Red in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!