I am reading data in from a url, parsing it, and then attempting to format the data further:
year = 2008;
month = 9;
day = 30;
raw = urlread(sprintf('http://www.wunderground.com/history/airport/KCVS/%i/%i/%i/DailyHistory.html?HideSpecis=0&theprefset=SHOWMETAR&theprefvalue=0&format=1',year,month,day));
data = textscan(raw,'%s %s %s %s %s %s %s %s %s %s %s %s','Delimiter',',','HeaderLines',2,'CollectOutput',true);
dir = data{1}(1:end-1,7);
wind = cellfun(@str2num,data{1}(1:end-1,8),'UniformOutput',false);
gust = cellfun(@str2num,data{1}(1:end-1,9),'UniformOutput',false);
wind{cellfun(@isempty,wind)} = 0;
gust{cellfun(@isempty,gust)} = 0;
Now wind{cellfun(@isempty,wind)} = 0;
works however gust{cellfun(@isempty,gust)} = 0;
does not, instead I get this error that says: ??? The right hand side of this assignment has too few values to satisfy the left hand side. cellfun(@isempty,gust)
is properly returning a logical array. Also gust{1} = 0
will work. Why does it work for wind but not gust?