finding data from a big matrix
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I have the followin question: I have a big matrix A (1140X837).With help of Matlab I calculated the following data [av index] =sort( FinalAverage). Where av is matrix (1140X1) and contains a column that has zeors and some non-zero numbers that are the averages. In matrix index (1140X1) there is a column that has numbers that correspond to the zeros and its averages from matrix av. Now I am trying to find in matrix A what meaning were given by the numbers on the matrix where I told you above they put an average.(matrix av) . How can I automate in matlab, that is, find what average they put in matrix A (this is true for those who out an average in matrix av).
Your help is important.
19 个评论
Jan
2019-6-4
@stelios: Okay, this is a good direction. I'm still not sure, what you are asking for. I try to translate this to Matlab. Actually you have this code already, so it might have been easier, if you post it:
A = rand(1140, 837);
sA = size(A);
% "I choose a column":
c = randi(sA(2), 1);
% " I randomly zeroshed some values from this column":
A(rand(sA(1), 1) > 0.9, c) = 0;
% " calculated the difference that occurs with the other columns in matrix A"
B = A(:, (1:sA(2)) ~= c) - A(:, c);
% "chose the columns that had the smallest difference"
% ??? How is "smallest difference" defined between a set of vectors?
smallest = ???
av = mean(B(:, smallest), 2);
% " In matrix index there are the rows to which my averagrs belong
% and I have all sorts of things in the end."
Here I'm completely lost. And the last sentence is not clear to me also:
% for every average>0 to see what values the original column
% I have selected from matrix A
I guess, all you need is to find some indices, perhaps related to smallest or to the columns of A, which are not the chosen column: (1:sA(2)) ~= c. Maybe it is just one line of code.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!