How can I place all the values less than 1 into a new array
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ubaid haroon
am 2 Aug. 2016
Kommentiert: ubaid haroon
am 3 Aug. 2016
Lets say I have an array x = [ 1 2 3 4 5 6 0 1 0 4 0 8 0 8 6 0], from which I want to read only the zeros and place them in a new array. so far I have this
for i = 1:size(x)
for m = 1:size(x)
if x(i) < 1
newArray = [x(m) > 1]
end
end
end
Not sure how to implement this. any help would be appreciated
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 2 Aug. 2016
Bearbeitet: Azzi Abdelmalek
am 2 Aug. 2016
x = [ 1 2 3 4 5 6 0 1 0 4 0 8 0 8 6 0]
out=x(x<1)
you can calculate
y=setdiff(x,out)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!