Reputation: 5
i have a small problem.
i have a 3D matrix, and i want to seperate values greater than 0.1 into a new matrix, but keep the dimentions intact.. Because it is 24x45x65. and 24 = hours, 45 = days and 65 = customers.
is it possible? i used find()
no luck..i used x_weekday(x_weekday > 0.1)
i get the values greater than 0.1 but all in 1 column..and it destroys the dimention.
help please.
i have attached the file as link if need be. file: x_weekday.mat
Upvotes: 0
Views: 91
Reputation: 221614
Approach 1:
%%// new_x_weekday would be the one you are after, assuming you want to
%%// keep the rest of the data that are not greater than 0.1 to be 0
new_x_weekday = zeros(size(x_weekday))
new_x_weekday(x_weekday>0.1) = x_weekday((x_weekday>0.1))
Approach 2:
new_x_weekday = x_weekday;
new_x_weekday(new_x_weekday<=0.1)=0
Upvotes: 1