필터 지우기
필터 지우기

How can I call the method of one class in another class method as a input argument?

조회 수: 6 (최근 30일)
classdef Conductance
properties
Conductivity
Contact_Area
Breadth
end
properties(Dependent)
Leitwert
end
methods
function obj = Conductance(Lambda, A_1_2, b)
obj.Conductivity = Lambda;
obj.Contact_Area = A_1_2;
obj.Breadth = b;
end
function L = get.conductance(obj)
ind = obj.Conductivity > 0 || obj.Contact_Area > 0 || obj.Breadth > 0 ;
L = obj.Conductivity(ind) *obj.Contact_Area(ind)/(.5*obj.Breadth(ind));
end
end
end
I have a different objects of same properties with different values. Now I need to calculate the conductance between two nodes after caculating the conductance of each node. How can I write code to find the conductance between two nodes in the same class file? if not, How can I call the class Conductance in another class to find the total conductance?
  댓글 수: 4
Geoff Hayes
Geoff Hayes 2019년 5월 15일
I have a module of 6 different objects(different values) which share the common properties(Conductivity, Breadth, Area).
So does that mean they are six instances of the class Conductance? Or do you have six different classes that have the same set of three properties?
surendra kumar Aralapura mariyappa
I have only two instance in class Conductance first one Conductance Class constructor for assigning the values of properties. Second one is conductance which is dependent on properties (Conductivity, Contact_Area, Breadth). From second class method I am finding the conductivity of each object (Node1, Node2, Node3, Node4, Node5, Node6). Then I have to give the conductivity of two nodes as a input arguments to third method of class Conductance. But I don't know how to write the code for this third method?
Secondly I have another option to compute the conductance between two nodes by creating another classfile class called TotalConductance. For this TotalConductance inputs are outputs of class Conductance whichi means (Node1.conductance and Node2. Conductance)

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Construct and Work with Object Arrays에 대해 자세히 알아보기

태그

제품


릴리스

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by