Data Processing of a Matrix

1 visualización (últimos 30 días)
stelios loizidis
stelios loizidis el 13 de Mayo de 2019
Comentada: stelios loizidis el 14 de Mayo de 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 comentarios
Bob Thompson
Bob Thompson el 13 de Mayo de 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 el 14 de Mayo de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by