필터 지우기
필터 지우기

Right display of error!

조회 수: 1 (최근 30일)
Ashish
Ashish 2014년 8월 25일
댓글: Ashish 2014년 8월 26일
I have two variables in my .m file, which calculates- "possible_hrs" and "diff". The error is thrown if the required hours > possible hours.
error('For this Regular working shift, the maximum working time for a ONE-GO step is ',possible_hrs,'hours.', ...
'Please decrease Step Duration weather by' ,diff, ' hours or increase the working hours');
But the MATLAB gives me a warning- "The Format String might not agree with the argument count".
And finally it is not displayed correctly also (in the situation of error). What could be the solution?

채택된 답변

Julia
Julia 2014년 8월 25일
Hi,
After I read the Matlab help I think this should work:
error('For this Regular working shift, the maximum working time for a ONE-GO step is %d hours. Please decrease Step Duration weather by %d hours or increase the working hours', possible_hrs, diff);
  댓글 수: 3
Julia
Julia 2014년 8월 25일
This works in the command window:
>> error('For this Regular working shift, the maximum working time for a ONE-GO step is %d hours. Please decrease Step Duration weather by %d hours or increase the working hours',24,5)
For this Regular working shift, the maximum working time for a ONE-GO step is 24 hours. Please decrease Step Duration weather by 5 hours or
increase the working hours
Ashish
Ashish 2014년 8월 26일
I just realized that it did work. I guess, was doing something wrong!
Thanks!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Weather and Atmospheric Science에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by