Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
MATLAB HELP?
Hi guys, i'm wondering if you could help me with programming using MATLAB
i'll give a simple example to explain my problem.
switch 'x'
case 'Black
b=1
case 'Brown'
b=2
end
for some reason when i choose black from my GUI pop up menu, it wouldnt work when i click Black but when i click 'Brown' it works! please help.
1 Answer
- ooorahLv 64 years ago
You're missing the single-quote after 'Black. I'm surprised that it worked for Brown though, because you should not have quotes around 'x'. Otherwise, it's checking to see if the character vector 'x' is the same as 'Black or 'Brown', which should never be true. However, the variable x may hold the value of 'Black' or 'Brown'.