MATLAB: How to do? Tsol=(G==0)=Tamb

fast changeMATLAB

G=[1;0;2;3;0];
Tsol=[11; 12; 13;14;15];
Tamb=[10;15;16;16;12]
Tsol(G==0)=Tamb;
if all the variables are only one row it works but when is an array not.
Thanks

Best Answer

No, your example doesn't run and will not generally work for vector input either. However, this might be what you want:
Tsol(G==0) = Tamb(G==0);