Evaluating Method for multiple Objects, without using Eval
이전 댓글 표시
Good Evening together !
I am working with two classes:
Class I
Properties : temperature
pressure
components ( is a cell array of objects of the Class 2)
%Varying size dependent of No of Components in the Class 1
Class 2
methods : saturationPressure(obj, Temp)
classdef Class 1
properties
pressure
temperature
molarFlow
components
end
.
.
.
function value = boilingPoint(obj,T)
.
.other_functionstufff .
.
. % Need to evaluate the saturationPressure method of the the given components
for i = 1:numel(obj.components)
obj.#{components}#.saturationPressure.(obj.components{i},T)
end
.
.
Three Questions:
- Is there a way to evaluate the saturationPressure method of Class2 objects for all components of Class 1, without evalin?
2. Is there generally a better approach to evaluate methods of Objects inside a method of another Class
3. Or is there a obvious more clever way to achieve the same task (other datatype of components or similar )?
I would be very thankfull for help, i have the feeling i am oversseing something obvious -.-'
Thank You!
채택된 답변
추가 답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Data Type Identification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!