필터 지우기
필터 지우기

Conversion to double from struct is not possible.

조회 수: 3 (최근 30일)
Víctor Magdaleno
Víctor Magdaleno 2020년 7월 30일
댓글: Víctor Magdaleno 2020년 8월 8일
Hello everyone,
I'm a matlab beginner. I imported txt files to matlab whitout problem, so I want to remove all DC noise of them in a loop. Could someone help me to reach this goal?
Filenames = dir('*mat');
numfiles1 = length(Filenames);
EEGSinDC = [];
for i = 1 : numfiles1
load (Filenames(i).name);
EEGSinDC(i) = Filenames(i);
EEGsinDC = EEGSinDC(i) - mean(EEGSinDC(i));
end
Conversion to double from struct is not possible.
  댓글 수: 2
James Tursa
James Tursa 2020년 7월 30일
What variables are in the mat files?
Stephen23
Stephen23 2020년 7월 30일
Víctor Magdaleno's incorrectly posted "Answer" moved here:
registro is the variable

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

채택된 답변

Alan Moses
Alan Moses 2020년 8월 6일
The variable name can be used to select only the required data from the MAT file. To save the changes made to your data back to the MAT file, you can use the save function.You can use this piece of code to solve the issue:
Filenames = dir('*mat');
numfiles1 = length(Filenames);
for i = 1 : numfiles1
%replace with your variable name in the below line of code
load(Filenames(i).name, 'variableName');
variableName = variableName - mean(variableName);
%save(Filenames(i).name,' variableName ');
end
Alternately, you can use the matfile function if you wish to change the variables without loading the data into the workspace.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2020년 8월 6일
Filenames = dir('*mat');
numfiles1 = length(Filenames);
EEGSinDC = cell(numfiles1, 1);
for i = 1 : numfiles1
filedata = load(Filenames(i).name);
EEGSinDC{i} = filedata.registro - mean(filedata.registro);
end

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by