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

조회 수: 6 (최근 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에서 Instrument Connection and Communication에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by