How to get myBinomTest.m to work with array input, not just scalar
5 views (last 30 days)
Show older comments
Hi,
I am trying to implement a script (myBinomTest.m) within a script which I've written, for a lat/lon grid. I can execute myBinomTest.m at the command prompt (i.e. I type in the inputs (for 1 grid cell) and get a sensible-looking output. However when I type in the input which are arrays (for 91x144 gridcells) I get NaNs as output (disp(pout)). I've tried using do loops and executing the script for each gridcell at the command prompt, but still get the same result. The myBinomTest.m does say that the inputs can be scalars or arrays but it doesn't seem to work with arrays...unless I'm doing something wrong. Can anyone suggest a way I might get this script to work with arrays, not just scalar inputs?
Thanks Mad.P
My commands I'm using:
s_sim2 = ncread('droughtcalc_sim2.nc','nmth_sim2');
n_sim2 = ncread('droughtcalc_sim2.nc','totmth_sim2');
p_sim2 = ncread('droughtcalc_sim2.nc','pctprob_sim1');
lon = ncread('droughtcalc_sim2.nc','lon');
lat = ncread('droughtcalc_sim2.nc','lat');
for i=1:144
for j=1:91
pout=myBinomTest(s_sim2,n_sim2,p_sim2,'Greater');
end
end
disp(pout)
0 Comments
Answers (1)
Walter Roberson
on 8 Aug 2012
Possibly
pout(i,j) = myBinomTest(s_sim2(i,j), n_sim2(i,j), p_sim2(i,j), 'Greater');
See Also
Categories
Find more on NaNs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!