Data Processing of a Matrix

2 Ansichten (letzte 30 Tage)
stelios loizidis
stelios loizidis am 13 Mai 2019
Hellow,
I have stuck to a point of the code I am writing. In summary, there is a matrix (ReviewMatrix) that carries data from an excel file. I then try to remove some random data from this matrix and create a new matrix (NewReviewMatrix) What I am having trouble is how to replace the SupReviewTable with the new matrix (NewReviewMatrix) so I can calculate VisitorsSim. Below is the code I wrote.
load("ReMatrix")
SupReviewMatrix=(ReviewMatrix>0)
A=sum(SupReviewMatrix)
th=5 %threshold
for i=1:1000
if A(i)>th
ReductionRatings=th-A(i) % scores decucted visitors who went to several locations
while (ReductionRatings>0)
Location=randi(800)
if (SupReviewMatrix(location,i)>0) % positive review and will remove it
SupReviewMatrix(location,i)=0
A(i)=A(i)-1
ReductionRatings=ReductionRatings-1
end
end
end
end
sizeMatrix=size(ReviewMatrix)
visitor_num=sizeMatrix(2)
location_num=sizeMatrix(1)
visitor=400
visitor_column=SupReviewMatrix(:,visitor)
Visitor_Matrix=(visitor_column*ones(1,visitor_num)).*SupReviewMatrix
VisitorsSim=sum(Visitor_Matrix)
  7 Kommentare
Bob Thompson
Bob Thompson am 13 Mai 2019
Ok, I have a better handle on what you're asking now.
If you aren't sure if your matrix is correct or not, I would suggest making a new matrix, rather than modifying the old one. To do this just change the variable names inside the loop.
If you are looking to calculate the visitor_column, visitor_matrix, and visitorsim with the new matrix each time, then just move the calculations inside the loop. Just be sure and index your results, or you will only see the final result.
As I mentioned earlier, your loop is not currently making any changes because your logic is coming back false every time. Make sure you update that.
stelios loizidis
stelios loizidis am 14 Mai 2019
Because I was confused, how to fix the loop and the index of the matrices because I want to figure out I will put them in the loop as suggested to me and I also want to see all the values not only the final value.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by