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

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 Comments

surendra - by I have a different objects of same properties with different values do you mean that you have two instances of the same class?
Mr. Hayes,
I have a module of 6 different objects(different values) which share the common properties(Conductivity, Breadth, Area). From these properties first I have to find the conductance of each object, after that conductance between the objects to be computated. For an example, between 1 and 2 first conductance of 1 and conductance of 2 should be calculated, finally conductance between 1 and 2 should be computated. In my code I haven't yet written the code or method to compute conductance btween 1 and 2. From the above code I can calculate the Condutacne of object with different values of properties. But I can't compute the conductance between object 1 and object 2.
Node1 = Conductance(508, 4025, 50);
Node1.conductance;
Node2 = Conductance(231, 4025, 50);
Node2.conductance;
Totalconductance = 1/(1/Node1.conductance)+(1/Node2.conductance)); yet to wrtie the method or define the another class for Totalconductance.
So I need to know, How can I add one more method to find the conductance between Node 1 and Node 2 in Conductance class file? is it possible or not?. Or else how can I call the Conductance class as a input argument to another class constructor in different class file?
If you have any better idea, most welcome!
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?
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)

Sign in to comment.

Answers (0)

Categories

Find more on Construct and Work with Object Arrays in Help Center and File Exchange

Products

Release

R2014a

Tags

Community Treasure Hunt

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

Start Hunting!