Sie verfolgen jetzt diese Einreichung
- Aktualisierungen können Sie in Ihrem Feed verfolgter Inhalte sehen.
- Je nach Ihren Kommunikationseinstellungen können Sie auch E-Mails erhalten.
triind2sub is a helper function for working with the output of pdist. It's analogous to the way ind2sub works with linear indices of arrays to find the corresponding subscripts. Using triind2sub avoids the time and space required by using the squareform function.
Example:
square = [0 0; 0 1; 1 1; 1 0];
% find the distances between the corners of the unit square
dists = pdist(square);
% report the pairs of points with maximum separation
[col, row] = triind2sub(size(square), find(dists == max(dists)))
% report the pairs of points with minimum separation
[col, row] = triind2sub(size(square), find(dists == min(dists)))
Without triind2sub you could instead use
[col, row] = find(squareform(dists) == max(dists))
[col, row] = find(squareform(dists) == min(dists))
to achieve similar results but this approach is more than ten times slower, produces duplicates and requires more memory.
Zitieren als
James Ashton (2026). triind2sub (https://de.mathworks.com/matlabcentral/fileexchange/63205-triind2sub), MATLAB Central File Exchange. Abgerufen .
Kategorien
Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und MATLAB Answers
Allgemeine Informationen
- Version 1.0.0.0 (1,56 KB)
Kompatibilität der MATLAB-Version
- Kompatibel mit allen Versionen
Plattform-Kompatibilität
- Windows
- macOS
- Linux
| Version | Veröffentlicht | Versionshinweise | Action |
|---|---|---|---|
| 1.0.0.0 |
