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

 채택된 답변

Cris LaPierre
Cris LaPierre 2021년 7월 7일
편집: Cris LaPierre 2021년 7월 7일

0 개 추천

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');
addchannel(ai,0);
start(ai);
data = getdata(ai);
Equivalent code starting in R2016a
s = daq.createSession('ni');
addAnalogInputChannel(s,'Dev1',1,'voltage')'
data = startForeground(s);

댓글 수: 9

Ajai Singh
Ajai Singh 2021년 7월 7일
Thank you for the help , i appreciate it. I was able to resolved analoginput part of the code but i am getting error " too many inputs for daq.getDevices
Cris LaPierre
Cris LaPierre 2021년 7월 7일
편집: Cris LaPierre 2021년 7월 7일
Please share the full error message (all the red text). Without seeing your cody, my initial reaction is that daq.getDevices does not appear to accept any inputs (see documentation), so you may have a syntax error in your code.
Ajai Singh
Ajai Singh 2021년 7월 7일
Sorry for the confusion , can you please tell me the alternative of haqhwinfo command ?
Cris LaPierre
Cris LaPierre 2021년 7월 7일
MATLAB convereted to a session-based interface. See this page on how to transiion your code to the new interface.
So basically i need to convert this code
HWInfo = daqhwinfo(analoginput(handles.DeviceName,handles.DeviceID))
to 2018 where
handles.DeviceName = 'nidaq'
handles.DevideID = 'dev1'
Cris LaPierre
Cris LaPierre 2021년 7월 7일
See this session-based interface example (on the page I linked to previously). You can see the equivalent legacy-interface code just above it.
Thank you so much that was really helpful , but still i am stuck here at :
I cannot find the property (DifferentialIDs) of the object created by daq.getDevices
for example
HWinfo = daq.getDevices
HWinfo.DifferentialIDs
What does DifferentialIDs refer to??
Cris LaPierre
Cris LaPierre 2021년 7월 7일
I'm not sure what it refers to. My searching suggests it is not a property of session-based interfaces. I can't find any references to it at least.
Ajai Singh
Ajai Singh 2021년 7월 7일
Thank you so much for your help. I really appreciate it.

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

추가 답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 7월 7일

0 개 추천

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

Ajai Singh
Ajai Singh 2021년 7월 7일
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?

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

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2021년 7월 7일

댓글:

2021년 7월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by