Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
Software
»
comp.softsys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
substitute selected array element values with those from other array
Replies:
3
Last Post:
Jun 3, 2011 3:31 PM




substitute selected array element values with those from other array
Posted:
Jun 2, 2011 5:43 PM


I have 2 arrays:
LNOx_vert_ocean = bsxfun(@times, apply_250_km2, lnox_mass_frac_ocean); LNOx_vert_land = bsxfun(@times,apply_250_km2, lnox_mass_frac_land);
Both will have the size 332 x 165 x 27 x 3.
I want to substitute SOME (not all) elements in LNOx_vert_ocean with some elements in LNOx_vert_land.
The substitution will be based off of a 3rd array LU (land use). This array is 332 x 165. If the value of the elements in LU is not equal 16 then that is land. Those are the values to be substituted into LNOx_vert_ocean.
Amongst several things I have tried the following which did not work: LNOx_vert = LNOx_vert_ocean(LNOx_vert_land(LU ~= 16));
I got the following error: ??? Subscript indices must either be real positive integers or logicals. What am I doing wrong? I am limited to version 2009a
Thanks Jonathan



