Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

in matlab nested if statement not working properly?

조회 수: 1 (최근 30일)
Dhines
Dhines 2015년 10월 28일
마감: MATLAB Answer Bot 2021년 8월 20일
if code==0411106200445
open('product1.txt');
elseif code==506002830376
open('product2.txt');
elseif code==9781234567897
open('product3.txt');
elseif code==987654321098
open('product4.txt');
else
open('product5.txt');
end
when my result coming to this loop it opened always last txt file(product5.txt).. not working for other results... why?

답변 (1개)

Image Analyst
Image Analyst 2015년 10월 28일
It is working properly. None of your code values ever equal any of those integers. Your code is an integer isn't it? It's not a double or string is it? What does it say the value of code is when you step through it in the debugger? You are using the debugger aren't you?

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by