"SWITCH expression must be a scalar or a character vector".
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Urayoan Ramos Santiago
am 24 Okt. 2020
Kommentiert: Asad (Mehrzad) Khoddam
am 24 Okt. 2020
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.
0 Kommentare
Antworten (1)
Asad (Mehrzad) Khoddam
am 24 Okt. 2020
Try to get 'Value' in the call back function:
handles.patient = get(hObject,'Value');
2 Kommentare
Walter Roberson
am 24 Okt. 2020
No, you need to get both the String and the Value, and use the Value to index the String.
Asad (Mehrzad) Khoddam
am 24 Okt. 2020
Yes, you are right. 'Value' propertiy gives the index to the selected item.
Siehe auch
Kategorien
Mehr zu Visual Exploration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!