.m file compatible with linux

5 views (last 30 days)
María del Carmen Salas Casas
Answered: Dinesh on 7 Mar 2023
How could I transform a .m file to a .tar.gz file to be able to compile it in linux with library compiler? When I use library compiler and I hit "Package" it generates an .exe and I need a linux compatible file. Thank you.

Answers (1)

Dinesh
Dinesh on 7 Mar 2023
Hi Maria.
To convert a ".m" file to a ".tar.gz" file, follow these steps:
  1. Create a folder and include your ".m" file there along with any other input files or data.
  2. Then open the terminal or command prompt and navigate to that folder using the "cd" command.
  3. Then, the "tar" command can be used to create a compressed archive of that folder.
tar -czvf <filename>.tar.gz .
The "." is specified to tell that all the contents of the current directory are to be compressed.
4. Once you have the ".tar.gz" file, you can transfer it to your linux machine and then decompress it as follows.
tar -xzvf <filename>.tar.gz
This will create a directory containing the ".m" file and other files that you have compressed.
5. Now, open the terminal and navigate to this folder and then use the MATLAB compiler to compile the ".m" file into an executable:
mcc -m <filename>.m
Now you should have an executable that is compatibe with Linux.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!