Dear all,
I am new to the Mex-file world of Matlab. I have recently learnt to run a Mex file on my own PC. However, I eventually want to put the program on a linux server. I wonder if there is any handy way I can do this. Thanks, and I look forward to hearing from you!
Best, Long

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 23 Mär. 2022

0 Stimmen

You will need to recompile the mex function code under Linux; the .mexw64 generated on your Windows system will not work under Linux.
It is probably better to recompile it on the server itself, so that you get consistent tool-chains.

6 Kommentare

Long Hong
Long Hong am 23 Mär. 2022
Hi Walter,
Thanks so much for your kind response! Would you mind instructing me more on I could recompile under Linux?
I used Matlab coder to generate .mexw64, but it does not seem to have an option for me to choose a Linux system.
Thanks, and have a lovely day!
Long
Walter Roberson
Walter Roberson am 23 Mär. 2022
You would perform the same series of steps, but you would perform them on the Linux server. You cannot use the Windows system to create the Linux version (at least not easily.)
Long Hong
Long Hong am 23 Mär. 2022
Thanks, Walter!
I have an (un)related question if you do not mind. When I tried to generate a mex file, it says "findgroups" and "lagmatrix" (and some other programs) are not supported by code. I wonder if you have any way to go round this issue. Thanks!
If you are working with numeric or logical or categorical or string array or cell array of character vector, then
[Groups_IDs, Unique_elements] = findgroups(MATRIX);
can be pretty much replaced by
[Unique_elements, ~, Group_IDs] = unique(MATRIX);
I am not very familiar with lagmatrix(). It looks to me as if for the numeric case, it could be written in terms of arrayfun. Find the minimum lag, if it is less than zero then each copy of the matrix must be pre-padded with min(lag,0)-min(lag) NaN rows. Find the maximum lag, if it is positive then each copy of the matrix must be post-padded with an appropriate number of NaN. Once the vectors of prepad and postpad have been calculated then you can
cols = size(TheArray,2);
Lagged = cell2mat(arrayfun(@(Pre,Post) [NaN(Pre, cols); TheArray; Nan(Post, cols)], PrePad, PostPad, 'uniform', 0))
Long Hong
Long Hong am 23 Mär. 2022
Thanks so much, Walter! These are super helpful!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB Coder finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by