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!