Evaluating Method for multiple Objects, without using Eval
Mostrar comentarios más antiguos
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!
Respuesta aceptada
Más respuestas (1)
Ivan Lizat
el 6 de Dic. de 2020
0 votos
Categorías
Más información sobre Data Type Identification en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!