Sparse Array - Special Command?
Mostra commenti meno recenti
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!
1 Commento
Martin
il 12 Nov 2013
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Sparse Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!