How change the constructor class in each loop?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hey guys,
Well, I am developmenting a code that can calculate some parameters about pressure in a structure.
So, I have 4 constructor class and 3 class with methods of calculus. My problem is in the class Class_Advanced. In this class, I need to change the constructor in each loop, but the values not changes. The values in constructor needs to change because they influence another class, in this case, Class_Blast.
Of course my project is bigger than it, but I tried to simplify this project to ask you.
All classes is atached.
Next, my loop:
function this = Relation_Z...
(this, tnt, analysis, advanalysis, blast)
this.tnt = tnt;
this.analysis = analysis;
this.advanalysis = advanalysis;
this.blast = blast;
Z = this.advanalysis.Z;
W_final = this.advanalysis.W;
% ----------------------------------------------------------- %
% Initial parameters
N = 100; % Number of steps
stepZ = (40 - Z) / N; % Step Z
% ----------------------------------------------------------- %
% Calculating the curve
for i = 1 : N
pmax = this.blast.pmax;
this.matrix_DispZ(i,1) = Z;
this.matrix_DispZ(i,2) = pmax;
Z = Z + stepZ;
% Changind in constructor mode
Class_AdvAnalysis(Z, 1, W_final, N);
end
end
2 comentarios
Geoff Hayes
el 7 de Ag. de 2020
Ana - please clarify what you mean by My problem is in the class Class_Advanced...In this class, I need to change the constructor in each loop, but the values not changes. Do you mean that you want to use a different class (constructor) on each iteation of the loop? Or a different constructor for the class? It isn't clear from the above code and the comment "Changind in constructor mode" what you are attempting to do.
Respuestas (0)
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!