How to run an external Matlab(.m) files and call its functions from an application code-view file?

4 次查看(过去 30 天)
Here is the more content about the question:
  • I have created 3 different Matlab scripts with OOP (object oriented programming) to operate 2 different Keysight signal analyser and generator, including a Nema 17 stepper motor.
  • All of these scripts are functioning perfectly as per my requirements
  • For Keysight instruments, a connection with Matlab is required and for that three different ‘class’ are defined separately within each file for the hardware
  • I created many Matlab functions for individual tasks using SCPI programming language to operate(control) the Keysight instruments and to receive the values of the power and frequency of the signal
  • Now I want to use all these three scripts running in the background and want to use its functions working in an Matlab application, so basically I want to call the functions from predesigned scripts into a single application code to get the values and to control the instruments using the buttons
  • So, how do I run these scripts and use the functions in the application code?
  • Problems/requirements: 1. I cannot define more than one class within a single Matlab script. 2. If there is no class with defined object for a specific hardware I cannot use its functions designed for that particular hardware. 3. To establish connections and creating an object into the system, I need to run the scripts in the background first and then it is possible to use the functions
  • Please suggest me how can I solve this problem because I have been going through all the available resources but unfortunately I couldn’t find any reasonable answer
your assistance would be greatly appreciated
Thank you.

采纳的回答

dpb
dpb 2022-10-23
移动:dpb 2022-10-23
See <class-definition-and-organization> area in the docs -- you package your classes so your application can import them and thereby use any of the methods contained therein.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Acquisition Toolbox Supported Hardware 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by