The .mat file usage.mat contains yearBuilt, names, yearReconstruct, and score.
clear;close all;userInput=input("Please choose between the following numbers: 1,2 or 3.");Test("usage.mat",userInput);function Test(usage,userInput)usage=load(usage); figure(); if userInput==1 figure(1); y=yearBuilt; custom = 'v r'; z='Build Year'; else figure(2); if userInput == 2 y = yearReconstruct; y(yearReconstruct==0)= NaN; custom = '* b'; z='Reconstruction Year'; else figure(3); if userInput == 3 y=score; custom ='. g'; z='Overall'; else disp("Invalid input value, input must be either 1, 2, or 3"); end end end hold onx=names;plot(y,custom,'Markersize',10,'lineWidth',2,'LineStyle','none');xlabel('output');ylabel(z);grid onset(gca,'xticklabel',x.')xtickangle(-45);end
My code keeps displaying empty graphs or multiple empty graphs.
Best Answer