Sparse Array - Special Command?
이전 댓글 표시
Hi,
I'm dealing with a sparse array. Given 2 arrays "col" and "val", I want to create a one-rowed sparse array of value val(i) in the column col(i), for all i.
What I did is:
if true
% val, col given
leng = length(val);
row = ones(1, leng);
result = sparse(row, col, val, 1, leng);
end
Is there a better way to do, without creating an array "row" in particular? Because getting the length and creating the row take a bit of time in my problem.
Thanks!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Sparse Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!