desig GUI for com port
Show older comments
Hi Everyone , I am very new to MATLAB and have minimum proramming background. I am self educating to make GUI in MATLAB. here is what i wana get form that GUI, I want to be able to scrol the slider , Knob ( or so) to be able to send some "HEX" commands thru my com port. for example if I select "10" on that slider i want to be able to send my "HEX" command from the port. i have downloaded trial MATLAB.
please help!!!!
4 Comments
Rik
on 2 Mar 2019
This is a two step process. First you need working code, then you can make a GUI that calls those working functions with approriate inputs that the user can control through the GUI. You provide too little information on either to give an exact answer, but here are some hints that should be helpful.
You should look into the documentation for the uicontrol function to see what suits you best. There might also be some functions available on the FileExchange that provide aditional options.
My small guide to avoid GUIDE:
- Make a figure (with f=figure;) and look into the doc for figure which properties you want to turn off (you probably want to set Menu and Toolbar to 'none')
- Create buttons and axes and everything you need with functions like uicontrol and axes. Save the handles to each element to fields of a struct (like handles.mybutton=uicontrol(___);)
- When you've finished loading all data (and saving it to fields of your handles struct), and creating all the buttons, save your handles struct to the guidata of your figure like this guidata(handles.f,handles);. (You can also use getappdata and setappdata)
- You can set the Callback property of many objects. If you do, use a function name with an @ in front, or a char array that can be evaluated to valid code. (like @MyFunction or 'disp(''you pushed the button'')')
- Callback functions will be called with two arguments: the first is a handle to the callback object, the second is eventdata that may contain special information. To get access to your data, just use handles=guidata(gcbo);. You can replace the gcbo function with the name of the first input to your callback function if you prefer.
- More information about callbacks can be found in multiple places in the doc, for example here.
Harmandeep Kaur
on 4 Mar 2019
Rik
on 4 Mar 2019
You can use AppDesigner if you like, but if you choose not to use it, I would discourage you to use GUIDE. Instead I would advise you to use GUIDE for a quick draft for the layout and then use my hints posted in my small guide for the actual creation of your GUI. The main difference is that the AppDesigner acts as a class, and GUIDE (or my suggestion) will act as a function. You can mostly achieve the same end result, so it is largely a matter of taste which of the two you like working with the most.
Harmandeep Kaur
on 5 Mar 2019
Answers (0)
Categories
Find more on Use COM Objects in MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!