How i extract the components of a vector/matrix output ?
23 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Antonia Mocan
le 26 Nov 2020
Commenté : Ameer Hamza
le 26 Nov 2020
For example i have a function like a=polyfit(x,y,1) and the result is
a= 0.300 1.00
How can i extract a(1)=0.300 and a(2)=1.00?Thank you
0 commentaires
Réponse acceptée
Ameer Hamza
le 26 Nov 2020
Modifié(e) : Ameer Hamza
le 26 Nov 2020
Yes, that is the syntax. a(1) and a(2)
a=polyfit(x,y,1);
first_element = a(1);
second_element = a(2);
Read about indexing here: https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html
6 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!