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!