フィルターのクリア

GUI send available com ports to popup menu

9 ビュー (過去 30 日間)
Daniel
Daniel 2016 年 4 月 10 日
コメント済み: Daniel 2016 年 4 月 11 日
Hi, i want to chk all available com ports and make them visible to select in a popup menu. to find the ports I assume i need to use instrhwinfo('serial') in my code:
list = instrhwinfo('serial');
for i=1:length(list.SerialPorts)
ports{i} = list.SerialPorts(i);
end
set(handles.com_number,'string',ports);
where com_number is the tag of the popup menu but the list in the popup menu is empty what am i doing wrong?
  2 件のコメント
Geoff Hayes
Geoff Hayes 2016 年 4 月 10 日
d - where is the above code being called from? Is it within the _OpeningFcn of your GUI or within a callback? Please copy and paste the full function signature and body so that we can get an idea of how and where the code is being used.
Also, have you put a breakpoint at the line where list is initialized to make sure that there is at least one serial port? Is ports being populated?
Daniel
Daniel 2016 年 4 月 11 日
you both helped me a lot. you made me notice that i wrote it in the wrong place (not the openngFcn) and Walter directed me to an example. its working now. so thanks to you both

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 4 月 10 日

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by