How i extract the components of a vector/matrix output ?

23 vues (au cours des 30 derniers jours)
Antonia Mocan
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

Réponse acceptée

Ameer Hamza
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);
  6 commentaires
Antonia Mocan
Antonia Mocan le 26 Nov 2020
thank you very much!!
Ameer Hamza
Ameer Hamza le 26 Nov 2020
I am glad to be of help!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by