How to remove numbers from a vector?
Show older comments
I am using graphical data and looping round a set of data. So, how can I write an if statement to remove zeros from the start and end of the vector so that only the needed data is there, I dont want to remove all zeros though as the middle section of all the data sets has zeros which are needed?
The variable that the data sets loop through is called z_force
Accepted Answer
More Answers (1)
William
on 30 Dec 2020
You could use something like:
while z_force(1)==0
z_force(1) = [];
end
while z_force(end)==0
z_force(end) = [];
end
Categories
Find more on Loops and Conditional Statements 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!