32 bit exe with a code developed in 2017b Matlab version

1 次查看(过去 30 天)
Dear all, I have been reading several questions on the topic but it's not clear. I developed a code with matlab 2017b (that is a 64 bit). I created the corresponding exe file through the mcc command (the exe is then 64 bit) and everything worked.
Now I need to develope a 32 bit exe. I downloaded the last 32 bit Matlab version, that is 2015b, on the same computer. If I try to compile the code in 2015b, I got lot of errors because many commands are not recognized in this previous version. I am afraid I need to rewrite the code in order to run it on 2015b version and to have the 32 bit exe.
Is there a solution to get a 32 bit exe, without making the code compatible with a previous matlab version?
Thanks,
Ele

回答(1 个)

OCDER
OCDER 2018-8-28
I don't think you can make a backward-compatible 32-bit without changing your code. It's just one of those issue with backward compatibility.
One solution is to figure out what functions are missing, and then to make a function that replicates it. You could also use a switching function based on version. Some function may exist in the file exchange.
At some point, you'll have to decide if it's worth the time and effort to make and maintain a 32 bit version. Forcing users to use 64 bit isn't a bad idea considering 64 bit is better. Plus, if you have to compile 32 bit and 64 bit, each with different codes, then debugging and software development will become very complex.
function varargout = myFcn(varargin)
if verLessThan('matlab', '9.0.1') %9.0.1 is 2016a
[varargout{:}] = my_adaptation_of_matlab_fcn(varargin{:}); %you have to rewrite code
else
[varargout{:}] = matlab_fcn(varargin{:}); %matlab function in new version
end

类别

Help CenterFile Exchange 中查找有关 Parallel for-Loops (parfor) 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by