Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
union of 2 matrices

Subject: union of 2 matrices

From: dpb

Date: 31 Oct, 2012 21:17:25

Message: 1 of 2

On 10/31/2012 3:44 PM, Anita S wrote:
> Hello,
> I have 2 masks (both 128 X 128). The values in these matrices vary from 0-1.
...

> I basically need some value in this combined mask when both of the
> original masks have a value. If either of the masks have a zero, then
> the combined mask should have a zero in the equivalent column/row.

...

Isn't that a logical 'or' operation w/, perhaps some adjustment to final
values? If all you need is the True/False indication then or is all you
need; if you want a selection from A or B (have to decide which or some
other thing like an average if both are nonzero) then you need two steps
of A(A~-0) | B(B~=0) to pick the values from each. Excepting, of
course, you'll have to use an indexing operation since A(A~-0) will
return a column vector of values so you do need the index to subscript
step to place in correct location in the array.

--

Subject: union of 2 matrices

From: Roger Stafford

Date: 4 Nov, 2012 01:32:11

Message: 2 of 2

dpb <none@non.net> wrote in message <k6s4fd$o9u$1@speranza.aioe.org>...
> On 10/31/2012 3:44 PM, Anita S wrote:
> > If either of the masks have a zero, then the combined mask should have a zero in the equivalent column/row.
>
> Isn't that a logical 'or' operation w/, perhaps some adjustment to final
> values? If all you need is the True/False indication then or is all you
> need;
- - - - - - - - -
  If a zero is considered false and nonzero true, the description "If either of the masks have a zero, then the combined mask should have a zero ..." would amount to a logical 'and' operation, not an 'or'.

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us