Parse string of comparisons into a matrix

Versión 1.0 (3,88 KB) por Wei-Rong Chen
This function parses a string of pairwise comparisons into a matrix of graph.
90 descargas
Actualizado 17 abr 2015

Ver licencia

This function parses a string of pairwise comparisons into a matrix of graph.
The output matrix is a graph representing the input string of pairwise comparisons.
Example:
The input 'str' is a string containing descriptions of multiple comparisons, separated by 'delimiter'.
str = 'a > b ; c < b ; a > c < b' ; delimiter = ';'; ifSortElement = 1;
[out, elements] = PairwiseCompareString2GraphMatrix(str, delimiter, ifSortElement)
>> out =
0 1 1
0 0 1
0 0 0
, where the output matrix 'out' is a matrix of the truth values for each comparison, such that :
[a>a] [a>b] [a>c]
[b>a] [b>b] [b>c]
[c>a] [c>b] [c>c]
>> elements =
'a' 'b' 'c'
The output 'elements' contains the unique elements
in the input string, corresponding to
the row and column indice of the output matrix 'out'. .
If ' ifSortElement' = 1, then the output elements will be sorted.
If ' ifSortElement' = 0, then the output elements will be ordered as they appear in the input string.

Citar como

Wei-Rong Chen (2024). Parse string of comparisons into a matrix (https://www.mathworks.com/matlabcentral/fileexchange/50539-parse-string-of-comparisons-into-a-matrix), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2008a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre String Parsing en Help Center y MATLAB Answers.
Etiquetas Añadir etiquetas

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión
1.0