필터 지우기
필터 지우기

Data Processing of a Matrix

조회 수: 2 (최근 30일)
stelios loizidis
stelios loizidis 2019년 5월 13일
댓글: stelios loizidis 2019년 5월 14일
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
Bob Thompson
Bob Thompson 2019년 5월 13일
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 2019년 5월 14일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by