Azzera filtri
Azzera filtri

Add Available serial port into pop up menu

3 visualizzazioni (ultimi 30 giorni)
Shawn Chang
Shawn Chang il 17 Giu 2012
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 Commento
Walter Roberson
Walter Roberson il 17 Giu 2012
Please do not name a variable "text" as that conflicts with the important graphic function "text".

Accedi per commentare.

Risposte (1)

Walter Roberson
Walter Roberson il 17 Giu 2012
a = instrfind('Type','Serial');
for i = 1:length(a)
portnames{i} = get(a(i), 'Port')
end
set(handles.popup1, 'String', portnames);
  3 Commenti
Walter Roberson
Walter Roberson il 19 Giu 2012
Could you show me
size(a)
and
get(a(1))
Shawn Chang
Shawn Chang il 21 Giu 2012
size(a)
ans =
0 0
>> get(a(1))
??? Index exceeds matrix dimensions.

Accedi per commentare.

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by