필터 지우기
필터 지우기

switch function that does not work

조회 수: 1 (최근 30일)
Tor Fredrik Hove
Tor Fredrik Hove 2011년 10월 15일
What is wrong here:
This is my text:
function grade=switchletgrade1(quiz)
if quiz<0 ||quiz>4
grade='X'
else switch quiz
case 3
grade='B'
case 4
grade='A'
otherwise
grade='C'
end
end
end

채택된 답변

the cyclist
the cyclist 2011년 10월 15일
Your code works error-free for me.
Is it possible that you are inadvertently calling a different file with a pre-debugged version? Does the command
>> which switchletgrade1
give the file location you expect?

추가 답변 (1개)

Tor Fredrik Hove
Tor Fredrik Hove 2011년 10월 15일
I had an autofile version of the m-file when I deleteed it it wroked.
Here was a link which showed me where to turn off auto saving. Maybe I called the autosaved file? Said something about debugged in the link over if that was what you meant. anyway it worked!

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by