What does this parameter mean?

2 visualizaciones (últimos 30 días)
med-sweng
med-sweng el 18 de Abr. de 2014
Respondida: Image Analyst el 18 de Abr. de 2014
I came about this parameter passed to a function in `MATLAB`:
[X Y ones(n,1)]
Assume X: x-dimension; Y: y-dimension; n: size
What does the above mean?
Thanks.

Respuestas (2)

Walter Roberson
Walter Roberson el 18 de Abr. de 2014
It is equivalent to
horzcat(X, Y, ones(n,1))
ones(n,1) is a column vector of 1's that has n entries in it. If size(X,1) or size(Y,1) is not the same as n, then you would receive an error about incompatible dimensions.

Image Analyst
Image Analyst el 18 de Abr. de 2014
Your "Assume...." sentence is difficult and ambiguous, so I'll just describe it.
In order for that to work, you must have X be a n rows by "whatever" column matrix. Y must also be a n-rows by "whatever"-column matrix. Though the columns for X and Y may be different. ones() makes a n row by 1 column "column vector". The brackets stitch them all together from left to right.

Categorías

Más información sobre Operators and Elementary Operations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by