Hi,(adsbygoogle = window.adsbygoogle || []).push({});

I have a quick question regarding MatLab.

I have 3 matracies A, B and C.

For every entry equal to 1 in B, I want to let the corresponding entry in A be an integral of x from 0 to C.

ex.

for all (i,j)

if B(i,j)==1 then let A(i,j)=quad(@(x) x, 0, C(i,j))

A quick way to do this for large matracies I thought was to use the following syntax:

A(B==1) = quad(@(x) x, 0, C(B==1))

But get the following error:

??? Error using ==> quad at 70

The limits of integration must be scalars.

Is there any way around this other than a "for i, for j" statement?

Thanks,

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# MatLab Matrix Help

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**