error in pca code

4 次查看(过去 30 天)
Neo
Neo 2022-12-8
编辑: Neo 2022-12-8
hello I am trying to determine the pca graph for a couple of images but I get errors:
rng 'default'
M = 7; % Number of observations
N = 5; % Number of variables observed
X = rand(M,N);
% De-mean
X = actin2.tif
% Do the PCA
[coeff,score,latent] = pca(X);
% Calculate eigenvalues and eigenvectors of the covariance matrix
covarianceMatrix = cov(X);
[V,D] = eig(covarianceMatrix);
errors
>> untitled
Unable to resolve the name 'actin2.tif'.
Error in untitled (line 1)
coeff = pca(actin2.tif)
I want to classify the images by the different morphology.

采纳的回答

Bora Eryilmaz
Bora Eryilmaz 2022-12-8
You have to use the imread function to read the content of the image into a matrix. See imread.
So instead of
X = actin2.tif
you need
X = imread('actin2.tif')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dimensionality Reduction and Feature Extraction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by