Property assignment is not allowed when the object is empty. Use subscripted assignment to create an array element.
조회 수: 65(최근 30일)
표시 이전 댓글
This code is meant to read off a data stream from a creep frame and continuously save it until told to stop by attached ui. The problem is I had to move it to a new computer and reinstall everything necessary. Now I am getting a error from line 30 which states startBackground(s);
Property assignment is not allowed when the object is empty. Use subscripted assignment to create an array element.
here is the input code i used. a separate Ui is created where the controlling properties like time interval, radius, initial length, triaxality and displacement increment are told. along with a folder designated, and name of output file. What should happen is that once i press run, the program should start recording the data after file directory is selected. Instead as soon as file directory is selected I get the error.
here is the code
clc;clear;
% c is a struct
c.Date = clock;
c.Rate = 10;
%% Reading/Setting DAQ
s = daq.createSession('dt');
s.addAnalogInputChannel('DT9804(00)','0','Voltage');
s.addAnalogInputChannel('DT9804(00)','1','Voltage');
s.addAnalogInputChannel('DT9804(00)','2','Voltage');
s.addAnalogInputChannel('DT9804(00)','3','Voltage');
s.addAnalogInputChannel('DT9804(00)','4','Voltage');
s.Rate = c.Rate; % Background acuisition rate
%%
% Display graphical user interface
hGui = createDataCaptureUI(s);
% Add a listener for DataAvailable events and specify the callback function
dataListener = addlistener(s, 'DataAvailable', @(src,event) dataCapture(src, event, c, hGui));
% Start continuous background data acquisition
s.IsContinuous = true;
startBackground(s);
% Wait until session s is stopped from the UI
while s.IsRunning
pause(0.5);
end
delete(dataListener);
delete(s);
I looked up solutions to the error online. but they do not seem to apply.
the gui file doesn't seem to be the source of the problem
댓글 수: 1
Rick Zrostlik
2022년 9월 30일
I am getting the same error when trying to use my Data Translation 9847. However, I have ported my code from the 'Session' interface to the 'DataAcquisition' interface. My code:
>> daqlist
>> d = daq('dt')
>> d.Rate = 30000
>> addinput(d,'DT9847-3-1(00)','0','Voltage')
>> data = read(d,30000); %<--- this line causes the error for me
답변(1개)
per isakson
2022년 10월 2일
편집: per isakson
2022년 10월 2일
Always include the full error message in the your question.
I don't have the data acquisition toolbox. However, the error messages says that
- there is an empty object
- a property assignment to that object failed
- a subscripted assignment will work
Example:
obj = ClassA.empty, obj(1).t = 17 % subscripted assignment works
obj = ClassA.empty, obj.t = 17 % fails
Now it remains to find out which object is empty and why.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!