Vectors merging dynamically
1 次查看(过去 30 天)
显示 更早的评论
I have the following code
1 for i=1:Lev
2 R=A{i};
3 UTRP = crqa(R,[],[],[],threshold);
4 TRPfeat=[TRPfeat; UTRP];
5 UTRP=0;
6 end
In line 4, I am increment row of a matrix dynamically as loop increases.
Is there any other efficient way to do this? I need fast calculation, because the above code taking long time to execute...
0 个评论
回答(2 个)
Andrei Bobrov
2011-9-10
TRPfeat = cell2mat(cellfun(@(x)crqa(x,[],[],[],threshold),A(:),'un',0))
0 个评论
Jan
2011-9-12
C = cell(1, Lev);
for i = 1:Lev
C{i} = crqa(A{i}, [], [], [], threshold);
end
TRPfeat = cat(2, C{:});
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!