MATLAB: Data change Hi there, I have a 6 million x 1 array of prices. I want to change it so that it is +1 if P+1 > P, -1 if P-1 <P and 0 if P+1=P Best Answer sign(diff(P)); Related SolutionsMATLAB: How to go through each element of a vector without a for loop If P is an array of coefficients and x is the valuen = length(p)-1 ; iwant = sum(p.*x.^(n:-1:0))If x is an column arrayiwant = sum(sum(p.*x.^(2:-1:0),2)) ;Read about polyval. MATLAB: What is the meaning of p(1, :) in the following lines It refers to the first row and all columns of matrix p. So find(p(1,:) < -1.5+eps); means look through all the columns of the first row of p and find which ones satisfy the condition that they are less than -1.5+eps. Related Question“Subscript indices must either be real positive integers or logicals.” Error with analytic functionError using Taylor with order n as variable
Best Answer