Efficient matri x calculation

2 visualizzazioni (ultimi 30 giorni)
Kris zenitis
Kris zenitis il 18 Lug 2014
Modificato: Matt J il 18 Lug 2014
I am wondering if there exist a more efficient way to do the following (without double for loop).
ids = textread('ids.txt'); % ids Nx1 matrix
for indx = 1:length(data) %data Nx3 matrix
for j = 1:size(data, 2)
data_new(indx, j) = ids(data(indx, j));
end
end

Risposte (1)

Alfonso Nieto-Castanon
Alfonso Nieto-Castanon il 18 Lug 2014
data_new = ids(data);

Categorie

Scopri di più su Multidimensional Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by