Efficient matri x calculation

6 visualizaciones (últimos 30 días)
Kris zenitis
Kris zenitis el 18 de Jul. de 2014
Editada: Matt J el 18 de Jul. de 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

Respuestas (1)

Alfonso Nieto-Castanon
Alfonso Nieto-Castanon el 18 de Jul. de 2014
data_new = ids(data);

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by