MATLAB Answers

How can I have multiple arrays as an input for my function?

3 views (last 30 days)
James on 6 Sep 2019
Edited: James on 9 Sep 2019
If P and Q was a 1x3 array, how could I make that as an input in my function as the square brackets do not work. Thanks

  1 Comment

Stephen Cobeldick
Stephen Cobeldick on 6 Sep 2019
@James: pay attention to the syntax warnings that the MATLAB editor is showing you:
Those wiggly lines are not decorations. They show you syntax errors and ways that you should improve your code.
Reading the documentation is the best way to know how to write MATLAB code:

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 6 Sep 2019
function SquaredDistance = PixelDistance(P, Q)
P1 = P(1); P2 = P(2); P3 = P(3);
Q1 = Q(1); Q2 = Q(2); Q3 = Q(3);
now calculate the distance


Sign in to comment.

More Answers (0)

Sign in to answer this question.