Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Matlab, cell arrays

Krot_krotKrot_krot Posts: 1Member
Hi Matlab community
I desperately need help with matlab.

My data are stored as cell arrays (1x48 cells)(please, see attachment). Each cell contains 5 cells {1,1}, {1,2}...{1,5}.
Cells {1,1} contains image name and {1,3} contains onsets time.
I need to create a simple matrix in matlab with 6 columns (each column for each TYPE of image. Since there are 6 types of images: image1, image 2, image3..so there should be 6 columns) containing onsets for corresponding image.

to load this file in matlab I used two lines and formula:

clear all
uiopen('subjfmri1_1.res',1);

function field = loadlogfile( filename )
%

fid = fopen( filename );
if fid == -1
error( [ 'cannot open file ' filename ] );
end

text = fgetl( fid );
row = 1;

while ~isnumeric(text)
field{row} = getfields(text);
row = row + 1;
text = fgetl( fid );
end

fclose( fid );
eventMatrix=loadlogfile('subjfmri1_1.res');

I would be very pleased for any help or suggestions
thank you in advance
Sign In or Register to comment.