Assigning a function with multiple outputs to a structure

조회 수: 6 (최근 30일)
Alice Stembridge
Alice Stembridge 2015년 12월 9일
댓글: jgg 2015년 12월 10일
I have a function which has three outputs:
[krW, krO, krG] = relPerm3PH(sw, sg, varargin)
I also have a structure which contains the following fields:
fluid.krW
fluid.krO
fluid.krG
I am wondering if it is possible/how I can call my function to within the structure in order to calculate the specific (only one) outputs?
  댓글 수: 3
Alice Stembridge
Alice Stembridge 2015년 12월 9일
편집: Alice Stembridge 2015년 12월 9일
Thanks! I have just had the biggest memory block and that didn't even cross my mind.
The reason I have not done this is because for what I am wanting to do/have done for the rest of my properties is the following and I was wanting to know if there was a way to do this with multiple outputs.
fluid.muO = @(po,varargin)evalOilVis(po, varargin{:});
jgg
jgg 2015년 12월 10일
I'm unclear now on exactly what you're trying to do. The way that is written indicates that fluid.mu0 would be a function handle. Is that intended?
The object, as a function handle, can still have multiple outputs. Then fluid.mu0(x,vars) would returns multiple outputs.
Perhaps you could elaborate some more on what you are trying to do?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by