From: Sinisa Jelicic on 17 Feb 2010 18:03 Nevermind I found the answer In{1,1}{1,1}{3,1}
From: Nathan on 17 Feb 2010 18:12 On Feb 17, 2:56 pm, "Sinisa Jelicic" <tis...(a)gmail.com> wrote: > Ok, > > this is program > > fileList = dir('C:\Users\Laptop\Desktop\Matlab\fileList\kds') > fileList = fileList(~[fileList.isdir]); %remove directories > [junk, sortorder] = sort([fileList.datenum]); > fileList = fileList(sortorder); %list is now in ascending date order > numfiles = numel(fileList); > In = cell(1,numfiles); > for ii = 1:numfiles > fid = fopen(fileList(ii).name); > In{ii} = textscan(fid, '%s', 'delimiter', ';'); > fclose(fid); > end > > it creates 1x3 struct in every 3 columns is struct 1x10 struct and in every of those 10 columsn is 4000x1 struct. > > first line of raw data was > 1;1;Sanja;Jelicic;601;80270;133;a13rii8t;False;02/07/2010 00:03:07; > > and I want to know how to get 'Sanja' form this or how to get into 1 column, then in that coulum 3 rd column and in that column 1 row First, you need to stop using the word "struct" to describe your data. Running your code returns CELL ARRAYs, not STRUCTs. (Yes, there IS a difference.) To retrieve information from your CELL ARRAY, you can do something like this: retrieveddata = In{1}{3}{400}; Note the curly braces to retrieve the contents of the cell. Good luck. -Nathan
From: Sinisa Jelicic on 17 Feb 2010 19:35 > First, you need to stop using the word "struct" to describe your data. > Running your code returns CELL ARRAYs, not STRUCTs. (Yes, there IS a > difference.) > > To retrieve information from your CELL ARRAY, you can do something > like this: > > retrieveddata = In{1}{3}{400}; > > Note the curly braces to retrieve the contents of the cell. > > Good luck. > > -Nathan Ok, I have one more question if I wanna take 2 columns from 2nd set of cells array and let it be 400 element how do I write it retrieveddata = In{1}{2:3}{400}; -doesen't work if you get what I want Thanks Sinisa
From: Nathan on 17 Feb 2010 19:51 On Feb 17, 4:35 pm, "Sinisa Jelicic" <tis...(a)gmail.com> wrote: > > First, you need to stop using the word "struct" to describe your data. > > Running your code returns CELL ARRAYs, not STRUCTs. (Yes, there IS a > > difference.) > > > To retrieve information from your CELL ARRAY, you can do something > > like this: > > > retrieveddata = In{1}{3}{400}; > > > Note the curly braces to retrieve the contents of the cell. > > > Good luck. > > > -Nathan > > Ok, I have one more question > > if I wanna take 2 columns from 2nd set of cells array and let it be 400 element how do I write it > retrieveddata = In{1}{2:3}{400}; -doesen't work > > if you get what I want > > Thanks > Sinisa You can do it via cellfun, if you want. cellfun(@(x)x{400},In{1}(2:3),'un',0) Note, the outcome will be a cell array as well. -Nathan
From: Sinisa Jelicic on 17 Feb 2010 20:25 > You can do it via cellfun, if you want. > cellfun(@(x)x{400},In{1}(2:3),'un',0) > > Note, the outcome will be a cell array as well. > > -Nathan wow what @(x)x{400} represents what 'un',0 represents I have problem like this cell arrays <1x10><4500x1> and I need let's say 40th element from <4500x1> from first 3 columns of <1x10> Thanks Sinisa
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: help-- fit complex data Next: How do I execute *.m file and *.mdl file simultaneously |