MATLAB: How to save data in for loop

dataloopsave

I want to save the data in for loop but it only gives me the last data. How can I accumulate the data in row?
—————————-
Month ={'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'};
m=[];
for year = 2000:2001
for month = 1:12
m=sprintf('%04d%s', year, Month{month});
end
end

Best Answer

m{end+1}=sprintf('%04d%s', year, Month{month});
Related Question