Creating Pairwise comparison Triangular Matrix using Row name, Column Name and its corresponding compared output

1 Ansicht (letzte 30 Tage)
I am trying to create a matrix using the results produced by doing a pairwise comparison. As an example, my FOR loop generates the Row Name, Column Name and the comparison between these two as an output (The output comes after the series of calculations and not a difference or something).
For example, my For loop every time generates the following variables:
E1
E2
0.6154
E1
E3
0.5824
.
.
.
.
E52
E51
0.7014
So I want to have a triangular matrix which looks like as below
E1 E2 E3 E52
E1 0 0.6154 0.5824
E2
.
.
.
E52 . .
I don't see any functions to my knowledge does this part, can anyone help me here how to achieve this? Thanks
  1 Kommentar
Stephen23
Stephen23 am 21 Jan. 2018
Bearbeitet: Stephen23 am 21 Jan. 2018
"Creating Pairwise comparison Triangular Matrix using Row name, Column Name ..."
MATLAB is not Excel and it does not use column or row names. MATLAB uses indexing. Indexing is explained quite clearly in the introductory tutorials, which are highly recommended for all beginners:
Simply preallocate the output array and then use indexing in the loop.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by