How do I create bin widths using a simple algebra function?
显示 更早的评论
I have currently created a single bin for my vector time(0-5million years) using :
ExtractedData = data(find(time<5),2);
On this bin I have removed the NaN values and calculated the mean and SD. I need to repeat these calculations for bins which are 5-10million years, 10-15millionyears...etc until 540million years. I've been instructed to do this by creating a loop e.g.
for n=1:108
ExtractedData = data(find(time<5),2);
%%%code to remove NaN
%%%code to calculate mean and SD etc
end
and to change the part of the function "time<5" with a function for a maximum and minimum value of time where the minimum is defined by the function 5(n-1) and the maximum defined by 5(n-1)+5.
I was wandering how I can incorporate this into the line of code starting with "ExtractedData"?
Thanks
Charlie
采纳的回答
更多回答(1 个)
Steven Lord
2016-10-27
1 个投票
Rather than building the bins yourself, I recommend using the approach I described in one of your other questions that uses discretize.
2 个评论
Massimo Zanetti
2016-10-27
编辑:Massimo Zanetti
2016-10-27
Steven, the author of question in the link you posted is the same as here.. so I think he is really interested in knowing how to bin using another approach..
Charlie Finnie
2016-10-28
类别
在 帮助中心 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!