I am trying to create a cell array of different data type to a single matrix
- Take the first eleven columns. Some columns have decimals and characters.
- Take all the rows of data and store them on one single matrix
I am proceding the following way,
clc,clear all urlwrite('http://www.ndbc.noaa.gov/data/realtime2/41053.txt','SJ.txt'); % URL from CARICOOS
fid = fopen( 'SJ.txt', 'rt' );DataCell = textscan(fid, '%d%d%d%d%d%d%f%f%s%s%s*[^\n]', 'HeaderLines', 2, 'CollectOutput', 1) ; fclose(fid); Data = cell2mat(DataCell);
MATLAB outputs this error,
??? Error using ==> cell2mat at 47All contents of the input cell array must be of the same data type. Error in ==> SJ_F at 11Data = cell2mat(DataCell);
This is the way I want it stored
Data = Columns 1 through 10 '2013' '02' '23' '23' '50' '110' '5.0' '7.0' 'MM' 'MM'Column 11 'MM' % This is just one row of the data.
Could you please help?
Best Answer