The Math Forum

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.soft-sys.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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Jonathan W Smith

Posts: 90
Registered: 12/17/10
substitute selected array element values with those from other array
Posted: Jun 2, 2011 5:43 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.