Fill a vector with specific values from a matrix
Afficher commentaires plus anciens
Hello, I'd like to identiy which values are greater than 4 in matrix "a" and fill those values into matrix "b". The code I tried was this, but it didn't work.
a=[1 4 23 5
5 2 7 8
3 4 6 3];
for i=1:size(a,1)
for j=1:size(a,2)
if a(i,j) > 4
b(:)=a(i,j)
end
end
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Adaptive Control dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!