From: vgsangiuliano Poretti on
Hi, can anyone explain me how to assign sphere output to a field in a struct ?

I know for example that I can use [x y z]=sphere(100); ad then use surf(x,y,z) to plot a unity sphere.

Is it possible to do something like this:

var.test[x y z]=sphere(100); ???

I would like to assign the output of sphere to a variable which is part of a structure but i don't know how to do it.

var.test=[5 6 7]; creates a field test (1 by 3 matrix) in struct var and assigns the value 5 6 7 to it.

Thank you
From: someone on
"vgsangiuliano Poretti" <vgsangiuliano(a)gmail.com> wrote in message <hp5cqk$1ps$1(a)fred.mathworks.com>...
> Hi, can anyone explain me how to assign sphere output to a field in a struct ?
>
> I know for example that I can use [x y z]=sphere(100); ad then use surf(x,y,z) to plot a unity sphere.
>
> Is it possible to do something like this:
>
> var.test[x y z]=sphere(100); ???
>
> I would like to assign the output of sphere to a variable which is part of a structure but i don't know how to do it.
>
> var.test=[5 6 7]; creates a field test (1 by 3 matrix) in struct var and assigns the value 5 6 7 to it.
>
> Thank you

% I'm not exactly sure what you want, but does:

[var.test.x,var.test.y,var.test.z]=sphere(100);

% work for you?

% Then just use var.test.x as you would x in your example, etc.