vector manipulation by a function
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lila wagou
am 7 Apr. 2017
Bearbeitet: Image Analyst
am 8 Apr. 2017
Dear all; please how to trait a A vector (eliminate the elements stocked in B vector by order)
A = [10 52 33]
B = [3]
ii = num2cell([1]*setdiff(1:length(A),B(:)'),1);
out = A(ii{:});
i get out = 52 so i must get out = 10 52 (eliminate the third element)
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 8 Apr. 2017
Bearbeitet: Image Analyst
am 8 Apr. 2017
Don't do that complicated stuff with cell arrays, etc. If you want to delete the third element (or ALL the elements listed in B), then simply do
out = A; % Initialize an output variable - make a copy of A.
out(B) = []; % Delete indexes given in B
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!