I have a matrix made of 20x cells named T. each cell in this matrix contains the next thing:
1,26:00:01.490, 2.40,101.2, 7.8,-24.0,20.40,-0.76,-0.26
i would like to delimit and split it into columns so i used:
Data=regexp(T,',','split');
The result is that im getting Data = 20x1 cells and inside each cell theres another cell with the splited vector i wanted.
so far its all good but next thing i want to do is to take all of the time variables (26:00:01.490
for example) but they are inside 2 cells.
The thing i wanted to do is Data{:,1}{1,2}
but it says bad cell reference operation as an error.
someone knows how to take whole column in cell array which is inside another cell?
You can do it by concatenating the data between 1x9
cells by using a combination of vertcat
and {:}
.
%//First form T
str='1,26:00:01.490, 2.40,101.2, 7.8,-24.0,20.40,-0.76,-0.26';
str=repmat({str},20,1);
Data=regexp(str,',','split');
Data1=vertcat(Data{:});
%//Get your time data in form of cells
timeData_cells=Data1(:,2);
%//Get your time data in form of a matrix
timeData_matrix=vertcat(Data1{:,2}) %//This will work only if all time strings
%//have the same length.
%Answer
timeData_cells=
'26:00:01.490'
'26:00:01.490'
.
.
.
'26:00:01.490'
'26:00:01.490'
timeData_matrix=
26:00:01.490
26:00:01.490
.
.
.
26:00:01.490
26:00:01.490