can anyone please help me with these "if" "elseif" thingy..
Show older comments
i'm having troubles on making my function. Heres the type of file i want to use.
I. Concrete
Concrete Proportion
Class Mixture Cement(40kg/bag) Sand(m³) Gravel(m³) A 1:2:4 9.0 0.5 1.0
A. Column 1 Quantity=13(input) Height= 4.15m(input) Width= 0.2m(input) Length= 0.2m(input)
Volume= 0.2 x 0.2 x 4.15
= 0.166m³
Total volume= volume(quantity)
= 0.166m³(13)
= 2.158m³
Cement= 2.158m³x 9.0
=19.422 bags
Sand= 2.158m³x 0.5
= 1.079m³
Gravel= 2.158m³x 1.0
= 2.158m³
B. Column 2 Quantity=12(input) Height= 4.15m(input) Width= 0.25m(input) Length= 0.25m(input)
Volume= 0.25 x 0.25 x 4.15
= 0.259m³
Total volume= volume(quantity)
= 0.259m³(12)
= 3.11m³
Cement= 3.11m³x 9.0
= 28.01 bags
Sand = 3.11m³x 0.5
= 1.555m³
Gravel= 3.11m³x 1.0
= 3.11m³
C. Column Footing Quantity=25(input) Height= 0.2m(input) Width= 1.0m(input) Length= 1.0m(input)
Volume= 0.2 x 1 x 1
= 0.2m³
Total volume= 0.2m³x25
= 5m³
Cement= 5m³x 9.0
= 45 bags
Sand= 5m³x 0.5
= 2.5m³
Gravel= 5m³ x 1.0
= 5m³
D. Wall Footing
Height= 0.15m Width= 0.4m Length= 148m
Volume= 0.15 x 0.4 x 148
= 8.88m³
Cement= 8.88m³ x 9.0
= 79.92 bags
Sand= 8.88m³ x 0.5
= 4.44m³
Gravel= 8.88m³x 1.0
= 8.88m³
E. Roof Beam
Height= 0.3m Width= 0.2m Length= 116.5m
Volume= 0.3 x 0.2 x 116.5
= 6.99m³
Cement= 6.99m³x 9.0
= 62.91 bags
Sand= 6.99m³ x 0.5
= 3.495m³
Gravel= 6.99m³ x 1.0
= 6.99m³
F. Floor Slab
Area= 208.5m²
Thickness= 0.10m
Volume= 208.5 x 0.10
= 20.85m³
Cement= 20.85m³ x 9.0
= 187.65 bags
Sand= 20.85m³ x 0.5
= 10.425m³
Gravel= 20.85m³ x 1.0
= 20.85m³
Summary of the Materials
Cement= 422.912 bags say 423 bags Sand= 23.494 m³ say 24m³ Gravel= 46.988 m³ say 47m³
I want to make a program that would sum up all the cement,sand and gravel needed, just by filling up the inputs..any help would be very appreciated..sorry for my bad english ^_^
1 Comment
Jan
on 2 Oct 2011
Please post what you have done so far and which specific problems occurred. It is much easier to answer, if you ask a question.
Answers (1)
Andrei Bobrov
on 2 Oct 2011
inpdata = [13, 4.15, 0.2, 0.2
12, 4.15, 0.25, 0.25
25, 0.2, 1.0, 1.0
0, 0.15, 0.4, 148
0, 0.3, 0.2, 116.5
0, 0, 208.5, 0.1]
inpdata(inpdata==0)=1;
out = ceil(sum(prod(inpdata,2)*[9.0, 0.5, 1.0]))
Categories
Find more on Physics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!