How I can do? Tsol=(G==0)=Tamb
Show older comments
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
4 Comments
Image Analyst
on 19 Nov 2012
How about you give an example of when it's an array so we can help you?
Liviu
on 19 Nov 2012
Image Analyst
on 19 Nov 2012
Those are 1D vectors, not 2D arrays. Matt's solution will work fine on them. I don't know why you said it works with one row - I ran your code and it didn't work (but with Matt's fix it works). How did you get that to work????? In fact I believe Matt's fix should also work for arrays of any dimension since it uses linear indexing.
Liviu
on 19 Nov 2012
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!