フィルターのクリア

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 Center および File ExchangeText Data Preparation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by