Writing matlab function to go through all the elements of its input
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
Let's say I want to make a function for calculating the hypotenuse of a number of triangles with their two dimensions saved as 2 matrices x and y. So I want to make a function such that when I call it in the main terminal it will be [z] = hypotenuse(x,y); such that 'z' will be a matrix containing the hypotenuses of each x,y pair.
How?
Antworten (3)
bym
am 4 Dez. 2011
doc hypot
1 Kommentar
Paulo Silva
am 4 Dez. 2011
good one, +1 vote, that documentation got it all nicely, new users should start by reading the documentation first
David Young
am 4 Dez. 2011
It's just
z = hypot(x, y);
The function automatically operates on all the x,y pairs and returns a matrix of the results.
Bidyut
am 4 Dez. 2011
0 Stimmen
Answer by Mr. David Young is brief and accurate !! Excellent !!
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!