I need to work out the area of all residential areas. I tried using polyarea but cant get it to work.

1 view (last 30 days)
The code all works appart from the last 3 (talking about area.) I tried using polyarea but error comes up saying too many input arguements.
RoomTotalResidential =0;
for c = 1:1:sBuilding(n).bNoOfFloors
disp("--------------FLOOR "+c+" --------------")
subplot(sBuilding(n).bNoOfFloors,1,c);
title(sprintf('Floor %d',c));
sFloor(c).NoOfResidentialSpaces = input('Enter Number Of Residential spaces:');
FloorTotalResidential = sFloor(c).NoOfResidentialSpaces;
RoomTotalResidential = RoomTotalResidential + FloorTotalResidential;
if sFloor(c).NoOfResidentialSpaces > 0
for i = 1:1:sFloor(c).NoOfResidentialSpaces
sFloor(c).resident(i).width = input("Enter width of Residential room " +i+" on floor "+c+":");
sFloor(c).resident(i).length = input("Enter length of Residential room "+i+" on floor "+c+":");
choice1 = questdlg('Would you like to draw a floorplan?','question','yes','no','yes');
switch choice1
case 'no'
disp('No floorplan')
case 'yes'
locationx=input("Please specify bottom left corner X coordinate of residential room "+i+" on floor "+c+":");
locationy=input("Please specify bottom left corner Y coordinate of residential room "+i+" on floor "+c+":");
rectangle('Position',[locationx locationy sFloor(c).resident(i).width sFloor(c).resident(i).length]);
axis ([0 100 0 100]);
hold on
area = polyarea(locationx,locationy,sFloor(c).resident(i).width,sFloor(c).resident(i).length);
disp('The area is:'+area);
end
end
end

Answers (0)

Categories

Find more on Computational Geometry in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!