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

1 次查看(过去 30 天)
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 个评论
Stephen23
Stephen23 2018-1-21
编辑:Stephen23 2018-1-21
"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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by