MATLAB Answers

Migrating 2015b code to 2018b

4 views (last 30 days)
Hi everyone ,
I have a .m file which makes use of functions that were available only in 2015b version of matlab and now i need to make the code working on 2018b ? Can someone help to do this?
Thank you

Accepted Answer

Cris LaPierre
Cris LaPierre on 7 Jul 2021
Edited: Cris LaPierre on 7 Jul 2021
The analoginput function was removed in R2016a. See the release notes here (under Legacy Interface Removed).
Pre R2016a you might do this:
% Legacy code
ai = analoginput('nidaq','Dev1');
data = getdata(ai);
Equivalent code starting in R2016a
s = daq.createSession('ni');
data = startForeground(s);
Ajai Singh
Ajai Singh on 7 Jul 2021
Thank you so much for your help. I really appreciate it.

Sign in to comment.

More Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 7 Jul 2021
In fact, in general all M-files (Simulink .slx and .mdl files) are forward compatible. However, there a few fcn/command syntaxes have been changed in later versions of matlab. E.g.:
legend('Abc', 'Dce', 1) % Old version
legend('Abc', 'Dce', 'location', 'northeast')
  1 Comment
Ajai Singh
Ajai Singh on 7 Jul 2021
HWInfo = daqhwinfo(analoginput(handles.DeviceName,handles.DeviceID))
the above line has functions that were used in 2015b , can you help me to make it work on 2018b?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by