Matlab, cell arrays - Programmers Heaven

Howdy, Stranger!

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


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, there should be 6 columns) containing onsets for corresponding image.

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

clear all

function field = loadlogfile( filename )

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

text = fgetl( fid );
row = 1;

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

fclose( fid );

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