how to write afni file in MATLAB

Hi all,
I’m using the Princeton MVPA toolbox in MATLAB, with AFNI.
I did a searchlight analysis and got four of the accuracy maps for each fold (see the ‘MAE_L_srch_x’ in the pattern in the attached image).
Then, I got an averaged accuracy map by averaging those four maps (i.e., ‘MAE_L_srch_avg’), which is a format of [the number of voxels X accuracy].

My question is how to write an AFNI-readable file in MATLAB with the averaged map.
I’m trying to use the ‘write_to_afni.m’ function, and I get an error like the image showing an error message.

The variable ‘sample_filename’ is the file directory in the error, and in the directory, I have both BRIK, HEAD files of ‘270616OCY.AVmae.MVPA+orig.’
And I don’t get why the directory has ‘allvolszeros_/’ in front of it.

I would appreciate it if anyone gives me a hint to solve this issue! Many thanks in advance!

Hello,

I will refrain from commenting on Matlab, but it looks like you don’t have AFNI in your PATH (in bash), and so the attempted 3dcalc command (to generate an empty dataset) did not work.

Can you run AFNI programs from the shell? For example, what is the output (from a terminal prompt) of:

afni_system_check.py -check_all

  • rick

See this previous post for setting shell paths from inside Matlab.

https://afni.nimh.nih.gov/afni/community/board/read.php?1,158256,158279