Open and run a datafile with matlab compiled exe file

Hi, I am trying open a datafile(structural) with my test.exe file, which has been compiled by matlab. Each time I start the test.exe file, it takes 1-5 minutes. So, I am trying to upload the datafile.xyz and run a function, without re-opening test.exe.
So, my test.exe has a function
function read_data()
I want to double click datafile.xyz to run the function read_data() in test.exe, and read the structural data from datafile.xyz, and do further process. I don’t know where to start. Does matlab have some functions for this, or is it possible through powershell script?

댓글 수: 4

Provide the filename as input...why you want to double click on the file?
Mubin R
Mubin R 2022년 1월 22일
편집: Mubin R 2022년 1월 23일
I have lots of structural data-file with different names. I want to double click, so the data would be shown in test.exe as a table and run the calculation. I am doing my thesis, so I have to do as I have been told. I solved it with .vbs and .bat, but those codes are chaotic and unprofessional. As a result, I have to do it again. My supervisor suggested to use Powershell script, but he doesn’t know the process. So, I have to figure it out by myself.
Making sure your GUI behaves as a singleton is surprisingly hard. You could circumvent it by using uigetfile.
Is it possible to use open with” for a data file and it send its location address to any.mlapp file and it reads the data without relaunching the app. It works with m files.

댓글을 달려면 로그인하십시오.

답변 (1개)

Pratyush
Pratyush 2024년 1월 18일

0 개 추천

Hi Mubin,
To open ".xyz" files with your "test.exe" MATLAB compiled application and automatically run a function, follow these steps:
  1. Modify your MATLAB function to accept the file path as an input argument.
  2. Recompile your MATLAB application to accept command-line arguments.
  3. Optionally, create a wrapper script (batch or PowerShell) to call `test.exe` with the file path.
  4. Associate the ".xyz" file extension with "test.exe" or your wrapper script using Windows file associations.
  5. Double-click a ".xyz" file to test if it opens with "test.exe" and correctly passes the file path to your function.
Hope this helps.

카테고리

도움말 센터File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

제품

릴리스

R2020b

질문:

2022년 1월 22일

답변:

2024년 1월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by