Get value from a struct

1 Ansicht (letzte 30 Tage)
Philip
Philip am 3 Dez. 2014
Kommentiert: Image Analyst am 3 Dez. 2014
I have a function, RuKu4, which returns a struct file with three subvalues. The function is called like:
RuKu4([x1, x2], u) and returns
value: [2x1 double] sensX: [2x2 double] sensU: [2x1 double]
I would now like to call the function and just recieve the value parameter directly from the function. Something like RuKu4.value([x1, x2], u)

Akzeptierte Antwort

Adam
Adam am 3 Dez. 2014
Change the function and instead of returning the structure pull the field you want out of the structure within your function and return that instead.
  1 Kommentar
Image Analyst
Image Analyst am 3 Dez. 2014
Philip's "Answer" moved here:
That would be a solution, but the problem is that I don't know how to do that since the function is created with ACADO toolkit, and I need the other subparameters for other parts of the code.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Philip
Philip am 3 Dez. 2014
Just solved the problem with
f = getfield(RuKu4([x1 x2],u),'value')

Kategorien

Mehr zu Structures finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by