필터 지우기
필터 지우기

Add Available serial port into pop up menu

조회 수: 3 (최근 30일)
Shawn Chang
Shawn Chang 2012년 6월 17일
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
Walter Roberson
Walter Roberson 2012년 6월 17일
Please do not name a variable "text" as that conflicts with the important graphic function "text".

댓글을 달려면 로그인하십시오.

답변 (1개)

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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by