How change the constructor class in each loop?
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Geoff Hayes
2020 年 8 月 7 日
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.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!