Readwrite command in Data Acquisition toolbox returns "Unexpected exception in plug-in: 'Input data can only contain ASCII characters.'" Even with no input plugged in.
显示 更早的评论
I am trying to write an mfile to take an arbitrary signal vector, output it, and read the response from an accelerometer. On the way to this, I have successfully used the read command on the accel data from an accelerometer, and in my main code, the shaker triggers from the output signal. I have used this DAQ for a while with no problems in LABVIEW. But, once I invoke the readwrite command, nothing works. I kept getting the following error, with a square symbol as the only explanation for the error. Edit: I actually had to edit out the symbols because it broke the rest of the post.
"
>> sigreader
Error using sigreader (line 15)
"
So I copied the code directly from https://www.mathworks.com/help/daq/acquire-data-and-generate-signals-at-the-same-time.html
dq = daq("ni");
addinput(dq, "Dev1", "ai0", "Voltage");
addoutput(dq, "Dev1", "ao1", "Voltage") %%Updated this for my personal DAQ
output = cos(linspace(0,2*pi,1000)');
plot(output);
title("Output Data");
data1 = readwrite(dq, output);
plot(data1.Time, data1.Variables);
This generates the following error:
>> rwtest
Error using rwtest (line 10)
Unexpected exception in plug-in: 'Input data can only contain ASCII characters.'
At this point I have disconnected all of the sensors so the daq block is just empty. To reiterate, input works just fine using the read command, and the output will trigger using the readwrite command. I am at a loss and any ideas would be appreciated.
2 个评论
策符 洪
2022-3-1
I had a similar error, when I am trying ros command(ros2 topic list). I changed the character encoding to US-ASCII(slCharacterEncoding), but error still happened.
cecile conrad
2022-4-5
I have the same problem. Did either of you manage to solve this?
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Data Acquisition Toolbox Supported Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!