Effacer les filtres
Effacer les filtres

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

9 vues (au cours des 30 derniers jours)
Robert
Robert le 27 Oct 2016
Modifié(e) : Robert le 27 Oct 2016
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

Réponse acceptée

Robert
Robert le 27 Oct 2016
Modifié(e) : Robert le 27 Oct 2016
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');

Plus de réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by