Can you please say why this is coming? can you please solve this?
1 次查看(过去 30 天)
显示 更早的评论
function [Sample,Status,P0,RawP,RawT]=extract_data_P0(Nomfichier,SW_version)
%2 variable input 5 out put
opts=detectImportOptions('Capteur2125011.txt');
opts.DataLine=7;
opts.VariableNames={'SampleNumber','ReceivedFrame'};
RawData=(readtable(Nomfichier,opts));
Sample=table2array(RawData(:,1));
RawFrame=table2array(RawData(:,2));
%This code extracts data from a text file and converts it into two arrays
for i=1:length(RawFrame)
Status(i,1)=hex2dec(cat(2,RawFrame{i}(7:8),RawFrame{i}(10:11)));
P0(i,1)=hex2dec(cat(2,RawFrame{i}(19:20),RawFrame{i}(22:23)));
Error:
Error in extract_data_P0 (line 7)
RawData=(readtable(Nomfichier,opts));
3 个评论
Walter Roberson
2023-4-21
My guess is that you tried to run this function by pressing the green Run button. When you use the Run button, that is the same thing as executing the function without any inputs, as if you had executed
extract_data_P0()
which would fail when it tried to use the Nomfichier variable.
回答(1 个)
Image Analyst
2023-4-21
You forgot to attach 'Capteur2125011.txt'. My guess is that you're either creating fields of "opts" that are not valid in readtable(), or you are not passing a string or character array in for Nomfichier, but we don't know because you also forgot to attach the actual error message (ALL THE RED TEXT, not just a snippet of it).
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!