GUIDE Callback function error
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to create the simplest of simple GUIs with only one button that when clicked runs a .m file that is available in the Matlab path. The steps I take:
- Create new GUI with GUIDE and save as VHDL_Project_2014_Test
- Place one button in GUI and tag it buttonOpenCOM
- Modify the Callback function for buttonOpenCOM to run the .m file VHDL_Project_Open
- Save the project
- Run the main .m file (not the .fig file)
- When the GUI opens I click the button and get the following error message:
Error in VHDL_Project_2014_Test>buttonOpenCOM_Callback (line 81)
VHDL_Project_Open;
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in VHDL_Project_2014_Test (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
@(hObject,eventdata)VHDL_Project_2014_Test('buttonOpenCOM_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
Why is this error appearing? What can I do to remove it?
Note: I also get another error before this but this error I also get if I run the external .m file by itself (because nothing is connected to COM port 40 on my PC. For clarity this error message is:
Error using serial/fopen (line 72)
Open failed: Port: COM40 is not available. No ports are available.
Use INSTRFIND to determine if other instrument objects are connected to the
requested device.
Error in VHDL_Project_Open (line 22)
fopen(s);
2 Kommentare
David Sanchez
am 7 Mai 2014
could you attach the file with your code or paste it to see how you code it?
Akzeptierte Antwort
Roberto
am 7 Mai 2014
the problem isn't your GUI the problem is in your VHDL_Project_Open.m file, at the
fopen(s);
Line, this means that s is not valid!! this is mostly like because you don't have the COM40 port open in your computer, you have to ensure you know the name of the COM port opened in your computer, go to the Windows device administrator to see ports available.
3 Kommentare
Weitere Antworten (1)
Noor qazaer
am 2 Okt. 2017
i have a problem , what is a solve ????
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/178491/image.png)
1 Kommentar
Jan
am 2 Okt. 2017
Please open a new thread for a new question. This "thread hijacking" is confusing only and you cannot accept an answer, if it solves your problem. Please delete this pseudo-answer after you have created your own thread. Thanks.
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps 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!