How to delete multiple elements from array in step by step process and how to store remaining elements in array
Show older comments
I have an array A=[1 0.2 7 0.5 3 8]
I want to delete lowest number from this array
A(A==0.2)=[]
A=[1 7 0.5 3 8]
now again I want to delet lowest number from this
A(A==0.5)=[]
A=[1 7 3 8]
Now, How do I store different lengths array for future reference.
array={[1 0.2 7 0.5 3 8];
[1 7 0.5 3 8];
[1 7 3 8];
[7 3 8];
[7 8];
[8]}
is it possible with while loop ???
Accepted Answer
More Answers (1)
Jan
on 2 May 2021
A = [1 0.2 7 0.5 3 8];
nA = numel(A);
array = cell(nA, 1);
for k = 1:nA
array{k} = maxk(A, nA - k + 1);
end
1 Comment
BHUKYA VENKATESH
on 4 May 2021
Categories
Find more on Matrices and Arrays 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!