fuctions with 40 data lists?
1 回表示 (過去 30 日間)
古いコメントを表示
i have to write a program where i have 4 data cuboid1,cuboid2,cuboid3,cuboid 4 and each cuboid has length ,breadth and thickness i have write loop in such a way .......when i run this code
it selects one cuboid at a time and when each cuboid is selected ...by default its specification is also selected and later it is checked whether it is conductor or insulator
data={cuboid1,cuboid2,cuboid3,cuboid4);
specifiation cuboid its length breadth and thickness
length=[5 6 7 8 9]
breadth=[5 6 7 8 9]
thickness1=[5 6 7 8 9]
thickness2=[5 6 7 8 9] using for loop
there are two thickness for each cuboid...first it has to take th1 then execute
else th2 execute
3 件のコメント
Jan
2022 年 2 月 19 日
The question is not clear. Where are the "40 data lists"? Why has one cuboid 5 values for length, an breadth and 2 different thickness values?
What is the actual question? Which problem do you want to solve in Matlab?
回答 (1 件)
Walter Roberson
2022 年 2 月 19 日
cuboid1 = struct('length', [5 6 7 8 9], 'breadth', [5 6 7 8 9], 'thickness1', [5 6 7 8 9], 'thickness2', [5 6 7 8 9]);
cuboid2 = similar code
data = {cuboid1,cuboid2,cuboid3,cuboid4);
num_cuboids = length(data);
for idx = 1 : num_cuboids
this_cuboid = data{idx};
this_length = this_cuboid.length;
this_breadth = this_cuboid.breadth;
this_thickness1 = this_cuboid.thickness1;
this_thickness2 = this_cubuoid.thickness2;
results(idx,1) = classify_insulation(this_length, this_breadth, this_thickness1);
results(idx,2) = classify_insulation(this_length, this_breadth, this_thickness2);
end
2 件のコメント
Walter Roberson
2022 年 2 月 21 日
Given the length, breadth, and thickness, how do you figure out whether the object is a conductor or an insulator?
参考
カテゴリ
Help Center および File Exchange で Software Development Tools についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!