필터 지우기
필터 지우기

error message 'char'.how to solve?

조회 수: 2 (최근 30일)
md sazzad
md sazzad 2023년 4월 19일
댓글: Walter Roberson 2023년 4월 25일
function [EPClist,data]=extraction_data(Nomfichier)
dummy=importfile(Nomfichier);
j=1;
for i=1:height(dummy)
if dummy.OperationResult(i)==' Read OK'
data_raw(j,1)=dummy.Date(i);
data_raw(j,2)=dummy.EPC(i);
data_raw(j,3)=dummy.ReadData(i);
j=j+1;
end
end
clear dummy
EPClist=unique(data_raw(:,2));
Nb_capteur=length(EPClist);
data=cell(1,Nb_capteur);
for i=1:Nb_capteur
k=1;
for j=1:length(data_raw)
if data_raw(j,2)==EPClist(i)
%data{i}(k,1)=data_raw(j,1);
%data{i}(k,1)=0;
data{i}(k,1)=hex2dec(data_raw{j,3}(5:8));
temphexa=data_raw{j,3}(9:12);
if temphexa(1)=='F'
data{i}(k,2)=1/100*(hex2dec(temphexa)-hex2dec('FFFF')+1);
else
data{i}(k,2)=1/100*hex2dec(temphexa);
end
k=k+1;
end
end
EPClist{i}=EPClist{i}(end-3:end);
end
Error message:
Undefined function 'importfile' for input arguments of type 'char'.
Error in extraction_data (line 3)
dummy=importfile(Nomfichier);
Error in detect_palier (line 3)
[EPC,B]=extraction_data(titre);
Error in extract_palier (line 23)
[EPC,pression,temperature]=detect_palier(titre,table_delete);
  댓글 수: 1
Luca Ferro
Luca Ferro 2023년 4월 19일
importfile is not a matlab built-in function, could you share its code or where you have taken it from?

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2023년 4월 19일
The function importdata has an option to generate a function that will import other files using the same configuration. It is common for the generated function to be called importfile . But it is not part of MATLAB; it is the result of someone using importdata() and asking to save the associated code.
These days, looking at the imported data, you should probably instead use readtable
  댓글 수: 6
md sazzad
md sazzad 2023년 4월 25일
it is resolved. Thank you
Walter Roberson
Walter Roberson 2023년 4월 25일
You have to pass in a file name.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by