Trying to generate subplot figure

조회 수: 1 (최근 30일)
Nicholas Kavouris
Nicholas Kavouris 2023년 1월 11일
답변: Les Beckham 2023년 1월 11일
Recieving index error attempting to create a figure, how do I fix/why is this happening?
Index in position 1 exceeds array bounds. Index must not exceed 1.
Error in getFileSummary (line 2)
fileSummary=figure('Name','File Summary','WindowState','normal','Visible','on');
  댓글 수: 1
Nicholas Kavouris
Nicholas Kavouris 2023년 1월 11일
Here is a snippet of the beginning of the code
fileSummary=figure('Name','File Summary','WindowState','normal','Visible','on');
subplot(3,1,1);
grid on;
xlabel('Time (s)');
yyaxis left;
plot(cookdata.TempF,'Color','r','LineWidth',1,"DisplayName","Probe Temp F");
hold on;
yticks('auto');
ylabel('Temperature (F)',Color="r");
set(gca,'YColor','r');
yyaxis right;
yticks(0:0.5:max(cookdata.AugerPWM./100)+1);
ylabel('PWM/100 || RPM','Color','#FAA533');
set(gca,'YColor','#FAA533')
plot(cookdata.AugerPWM./100,'LineStyle','-','Color','#FAA533',"DisplayName","Auger PWM");
plot(cookdata.AugerRPM./1000,'LineStyle','-','Color','#21ABDE',"DisplayName","Auger RPM");
plot(cookdata.FanPWM./100,'LineStyle','-','Color','#94918D',"DisplayName","Fan PWM");
legend('Location','southoutside','Orientation','horizontal')

댓글을 달려면 로그인하십시오.

채택된 답변

Les Beckham
Les Beckham 2023년 1월 11일
It looks like you have created a variable named figure.
Type the following command at your command prompt:
which -all figure
built-in (/MATLAB/toolbox/matlab/graphics/figure)
If the output shows a line that says "figure is a variable", you should clear that variable and change whatever code created that variable to use a different name.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by