Add Available serial port into pop up menu
Afficher commentaires plus anciens
Hi,
I wish to get a list of available serial port in my computer and display them in the pop up menu. code:
a=instrfind('Type','Serial');
for i=1:length(a)
text{i}=a(i);
end
set(handles.popup1,'String',text);
guidata(hObject,handles);
but, there's nothing shown in the pop up menu. May i know which part i did wrongly? Thanks
1 commentaire
Walter Roberson
le 17 Juin 2012
Please do not name a variable "text" as that conflicts with the important graphic function "text".
Réponses (1)
Walter Roberson
le 17 Juin 2012
a = instrfind('Type','Serial');
for i = 1:length(a)
portnames{i} = get(a(i), 'Port')
end
set(handles.popup1, 'String', portnames);
3 commentaires
Shawn Chang
le 19 Juin 2012
Walter Roberson
le 19 Juin 2012
Could you show me
size(a)
and
get(a(1))
Shawn Chang
le 21 Juin 2012
Catégories
En savoir plus sur Resizing and Reshaping Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!