Examining entries in binary matrices and creating new group matrix based on % of connections (defined by 1)

조회 수: 2 (최근 30일)
Hi MATLAB users,
I am a newbie at MATLAB and am trying to run some analyses related to graph theory. I have multiple binary matrices (each 125x125) and would like to create a new 'group' binary matrix based on examining each entry in every matrix and determining if a connection, as defined by '1' in each entry, is present in 75% of all of matrices.
What is the best way I can go about doing this? Any code suggestions would be extremely helpful!
Thanks very much!

답변 (1개)

Christine Tobler
Christine Tobler 2018년 3월 21일
If you have each matrix stored in a separate variable, you can do
Atotal = A1 + A2 + A3; % Sum of logical matrices is a numeric matrix
Atotal = (Atotal/3 > 0.75) ; % Create a logical matrix where each entry is true if >75%
% of matrices have an entry that is true
If you have many matrices, it may be easier to store them all in a 3-D array of size 125-by-125-by-numMatrices. Then, the computation you describe can be done like this:
Atotal = sum(A, 3);
Atotal = (Atotal/size(A, 3) > 0.75);

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by