Error: Unable to resolve the name load.MATLABDriveTag
조회 수: 6 (최근 30일)
이전 댓글 표시
I'm trying to read multiples files .txt from the folder S1 with this:
clear, close all, clc
path_dados_originais = "C:\Users\35191\MATLAB Drive\Data\Projeto_Processamento\Dados_Sessoes\S1";
path_dados_interpolados = "C:\Users\35191\MATLAB Drive\Data\Projeto_Processamento\Dados_interp";
cd(path_dados_originais)
%Ficheiros a usar:
allfiles = dir;
Nfiles = size(allfiles(3:end,1),1);
for j=1:Nfiles
cd(path_dados_originais)
%Ler os dados
file = allfiles(j+2).name;
eval(['load' file ])
ecg_new = interp(ecg,5);
cd(path_dados_interpolados)
mat_dados = [ecg_new];
eval(['save' file(1:end-4) ' mat_dados'])
end
And i have this error:
Unable to resolve the name load.MATLABDriveTag.
Error in Untitled_interpolar (line 17)
eval(['load' file ])
댓글 수: 0
답변 (1개)
Vidip
2024년 2월 21일
The error you're encountering is likely due to a misuse of the eval function with the load command in MATLAB. When constructing a command string for eval, you must include spaces and properly format the file name with quotes. In most cases, using the eval function is also less efficient than using other MATLAB functions and language constructs, and the resulting code can be more difficult to read and debug.
Instead, you can directly call the ‘load’ and ‘save’ functions with the appropriate file paths and options. For example, use data = load(file, '-ascii'); to load ASCII text files, ensuring you specify the '-ascii' flag if your .txt files are formatted as such. Also, there's no need to change directories within the loop; you can use the ‘fullfile’ function to create full paths to the files.
For further information, refer to the documentation links below:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!