필터 지우기
필터 지우기

Can you please say why this is coming? can you please solve this?

조회 수: 1 (최근 30일)
md sazzad
md sazzad 2023년 4월 21일
댓글: Walter Roberson 2023년 4월 21일
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
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
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:

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by