MATLAB: How to convert a single char array in a table with 3 columns

data importwebread

I import a data from a web site with API, the data is a single char, 1-by-1, and I need to convert in a table with 3 columns, {year, month, data}
'Latitude (decimal degrees): 45.000Longitude (decimal degrees): 5.000Radiation database: PVGIS-CMSAFOptimal slope angle (deg.): Year Month Hh2005 Jan 45.52005 Feb 50.32005 Mar 1132005 Apr 1402005 May 1892005 Jun...

Best Answer

Suppose you have the character vector stored in the variable S. Then:
info_struct = regexp(S, '(?<Year>\d{4})\s+(?<Month>[A-Za-z]{3})\s+(?<Hh>\d+(\.\d+)?)','names');
Year = str2double({info_struct.Year}.');
Month = vertcat(info_struct.Month);
Hh = str2double({info_struct.Hh}.');
YourTable = table(Year, Month, Hh);