How to reduce the matrix

Sir,
I have a matrix of size 830x27,want to reduce the size to some ax27 using processpca?how to reduce it?

4 件のコメント

Zhang lu
Zhang lu 2013 年 5 月 2 日
編集済み: Zhang lu 2013 年 5 月 2 日
Hi.
a=rand(830,27);
n=10;
for i = 1:floor(size(a,1)/n)
eval(['a' num2str(i) ' = a(n*(i-1)+1:n*(i-1)+10,:)'])
end
Minnu
Minnu 2013 年 5 月 2 日
Now my matrix size is 10x27 .i want to know how to reduce the dimension of matrix without any loss of features
Zhang lu
Zhang lu 2013 年 5 月 2 日
a=rand(830,27);
n=30;
for i = 1:floor(size(a,1)/n)
eval(['a' num2str(i) ' = a(n*(i-1)+1:n*i,:)'])
end
if mod(size(a,1),n)~=0
I=floor(size(a,1)/n)+1;
eval(['a' num2str(I) ' = a(n*i+1:end,:)'])
end
Jan
Jan 2013 年 5 月 2 日
編集済み: Jan 2013 年 5 月 2 日
No, Zhang, do not do this. Using EVAL to hide an index in the name of a varibale is a really bad idea. This reduces the processing speed substantially, impedes debugging and required equivalently obtuse methods to access the variables later. It would be tremendously smarter to use an index as index (!):
a{I} = a(n*i+1:end, :)

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeElectrophysiology についてさらに検索

質問済み:

2013 年 5 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by