nested loop will not enter second iteration
显示 更早的评论
Hi,
Below is my code. For each month of each year I am trying to get the average and std for a set of values. The first iteration works for the first year. But then it does not continue. Can someone tell me where the problem is.
[M,ia,ic] = unique(CO2_FFD(:,2)); %find unique years, M = unique year, ia = row with unique year
m=[1;2;3;4;5;6;7;8;9;10;11;12];%set an array for 12 months
CO2_YM_averages = zeros(length(M)*12,2); %array for averages & std's, size of year*12months
for i=1:length(M)
yrows = find(M(i)==CO2_FFD(:,2)); %find rows where year is equal to M(i)
for j=1:length(m)
mrows=find(CO2_FFD(yrows,3)== m(j));%find rows where month = m(i)
CO2_YM_averages(j,1) = mean(CO2_FFD(mrows,8)); %average data for each month
CO2_YM_averages(j,2) = std(CO2_FFD(mrows,8)); %std data for each month
end
end
4 个评论
Image Analyst
2017-7-1
Undefined function or variable 'CO2_FFD'.
Please supply it so we can run your code.
Jennifer Walker
2017-7-1
Jennifer Walker
2017-7-1
Jennifer Walker
2017-7-1
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!