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

5 ビュー (過去 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 Center および File ExchangeData 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