How to allow a Matlab GUI using guide to have access to serial port objects

2 ビュー (過去 30 日間)
Robert
Robert 2016 年 10 月 27 日
編集済み: Robert 2016 年 10 月 27 日
So i have a little gui running and appears to be working. However one of the buttons is setup to execute a function that involves a serial port object that is live in the work space. The gui is throwing an error saying the the serial port object us undefined. So clearly it cannot not see all variables in the work space?
How do i get the gui to have access to all variables in the workspace? Or alt east one of them?
Thanks

採用された回答

Robert
Robert 2016 年 10 月 27 日
編集済み: Robert 2016 年 10 月 27 日
Im going to answer my own question incase someone else needs this and how i fixed the issues
Simply adding the following command in the callback function allowed my gui to have access to the any variable in the base workspace. In this case Motor1 was the name of the variable i wanted in the gui and also happens to be serial port object. the keyword base allows access to the base workspace
Motor1 = evalin('base','Motor1');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by