"SWITCH expression must be a scalar or a character vector".

조회 수: 18(최근 30일)
Urayoan Ramos Santiago
Urayoan Ramos Santiago 2020년 10월 24일
댓글: Asad (Mehrzad) Khoddam 2020년 10월 24일
Hello. I am trying to use a SWITCH statement that uploads a specific ECG data based on the selected string of a Pop-Up menu. This data should then be visualized in the Axes Box of the GUI. When I start running the GUI, the initial data is uploaded without any problems, but once I choose another string from the Pop-Up menu, it displays the error "SWITCH expression must be a scalar or a character vector." How do I fix this? I have uploaded photos of the Opening Function, plot function, and Pop-Up menu callback functions so you can better visualize the problem.

답변(1개)

Asad (Mehrzad)  Khoddam
Asad (Mehrzad) Khoddam 2020년 10월 24일
Try to get 'Value' in the call back function:
handles.patient = get(hObject,'Value');
  댓글 수: 2
Asad (Mehrzad)  Khoddam
Asad (Mehrzad) Khoddam 2020년 10월 24일
Yes, you are right. 'Value' propertiy gives the index to the selected item.

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by