Incorrect number of input arguments

조회 수: 4 (최근 30일)
Hidd_1
Hidd_1 2022년 1월 25일
댓글: Voss 2022년 1월 25일
I wrote the following code, and I got a message error regarding the input arguments:
lgd_1 = legend(app.UIAxes,'dTdhw(°C)','VDHW(L/min)','SP_VDHW(L/min)','Location','northoutside','Interpreter','none','Orientation','horizontal');
title(app.UIAxes,lgd_1,'string(app.Appliance_Model_1) + " Buit by: " + string(app.Appliance_Manufacturer_1), "Test info: " + string(app.Test_info_1)','Interpreter','none')
I got the following error message and I don't know why?!
Incorrect number of input arguments

채택된 답변

Voss
Voss 2022년 1월 25일
It doesn't make sense to pass your legend to the title() function. You can remove it:
lgd_1 = legend(app.UIAxes,'dTdhw(°C)','VDHW(L/min)','SP_VDHW(L/min)','Location','northoutside','Interpreter','none','Orientation','horizontal');
title(app.UIAxes,'string(app.Appliance_Model_1) + " Buit by: " + string(app.Appliance_Manufacturer_1), "Test info: " + string(app.Test_info_1)','Interpreter','none')
  댓글 수: 4
Hidd_1
Hidd_1 2022년 1월 25일
The following code worked
lgd_1 = legend(app.UIAxes,'dTdhw(°C)','VDHW(L/min)','SP_VDHW(L/min)','Location','northoutside','Interpreter','none','Orientation','horizontal');
title(lgd_1,[string(app.Appliance_Model_1) + " Buit by: " + string(app.Appliance_Manufacturer_1), "Test info: " + string(app.Test_info_1)],'Interpreter','none')
Thanks ;)
Voss
Voss 2022년 1월 25일
Great!

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

추가 답변 (1개)

Benjamin Thompson
Benjamin Thompson 2022년 1월 25일
Might need to see more code, or simplify your example down to one that does not depend on "app".
Initial guess is that the title function can only accept an axis object or legend object as the first argument, so you cannot pass both of them as the first two arguments. Since you passed axes to legend in the first line, trying to use legend again may be unnecessary, as the legend would have been put in your axis object already.

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by