Hi,
I'm trying to use the FieldTrip toolbox in MATLAB to load a file (cortex_8196.surf.gii), but I am getting an error that says it is unable to read the file.
This is the line that is causing the error:
sourcemodel = ft_read_headshape('C:\Users\Emmak\Documents\school\bmed_599\fieldtrip\fieldtrip20230204\template\, . . .
sourcemodel\cortex_8196.surf.gii');
This is the error:
Error using read_gifti_file
[GIFTI] Loading of XML file
C:\Users\Emmak\Documents\school\bmed_599\fieldtrip\fieldtrip-20230204\template\sourcemodel\cortex_8196.surf.gii
failed.
Error in gifti (line 89)
this = read_gifti_file(varargin{1},giftistruct);
g = gifti(filename);
What might be causing this?
Thanks!
Emma

댓글 수: 4

Most obvious thing first:
filename = 'C:\Users\Emmak\Documents\school\bmed_599\fieldtrip\fieldtrip-20230204\template\sourcemodel\cortex_8196.surf.gii';
ls(filename)
fileattrib(filename)
to check that the file exists and that it is readable.
Emma Jacobs
Emma Jacobs 2023년 2월 8일
편집: Walter Roberson 2023년 4월 19일
I think it exists and is readable, here is the result from that:
filename = 'C:\Users\Emmak\Documents\school\bmed_599\fieldtrip\fieldtrip- 20230204\template\sourcemodel\cortex_8196.surf.gii';
ls(filename)
fileattrib(filename)
cortex_8196.surf.gii
Name: 'C:\Users\Emmak\Documents\school\bmed_599\fieldtrip\fieldtrip- 20230204\template\sourcemodel\cortex_8196.surf.gii'
archive: 1
system: 0
hidden: 0
directory: 0
UserRead: 1
UserWrite: 1
UserExecute: 1
GroupRead: NaN
GroupWrite: NaN
GroupExecute: NaN
OtherRead: NaN
OtherWrite: NaN
OtherExecute: NaN
Walter Roberson
Walter Roberson 2023년 2월 8일
I would be interested to see what happens if you readstruct() the gii file.
Emma Jacobs
Emma Jacobs 2023년 2월 8일
>> readstruct('C:\Users\Emmak\Documents\school\bmed_599\fieldtrip\fieldtrip-20230204\template\sourcemodel\cortex_8196.surf.gii', 'FileType','xml')
ans =
struct with fields:
VersionAttribute: 1
NumberOfDataArraysAttribute: 2
MetaData: ""
LabelTable: ""
DataArray: [1×2 struct]

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

 채택된 답변

Sarthak
Sarthak 2023년 4월 19일

0 개 추천

Hi Emma,
It is a bit difficult to analyse the exact reason for your error without your model file,however as per my understanding there may be multiple reasons such as
  • File path issue
  • MATLAB and FieldTrip version mismatch
  • File corruption
  • Fieldtrip configuration issues
If you have verified that there are no such issues and you have the required dependencies and permissions to access the file, you may try to debug the code and use the step-in function feature to find the cause of the issue.
Attaching a documentation link for your reference

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2023년 2월 8일

편집:

2023년 4월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by