why doesn't my "if" statement work?
Show older comments
i have 2 columns that i am performing an element-wise foldchange analysis on columns A & B. if the result is less than 1 then the operation must be reversed. i have; 1. z=B./A % divide each element of B by corresponding A element 2. if z< 1 % if Z is less than 1 3. A./B*-1 % then divide A element by corresponding B element and multiply by -1 end
but i get no response from matlab. this should be easy but it's not. as always thanks for your time and input jb
Accepted Answer
More Answers (1)
Mark
on 4 Jun 2013
0 votes
The way you have it, you will only get the if statement to be satisfied if all elements of z are less than one. If you are trying to do this element by element, you could implement a loop through z to just change the ones that are <1.
1 Comment
john borsellino
on 4 Jun 2013
Categories
Find more on Multidimensional Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!