- #1
Apteronotus
- 202
- 0
Hi,
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,
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,