Efficient matri x calculation

2 次查看(过去 30 天)
Kris zenitis
Kris zenitis 2014-7-18
编辑: Matt J 2014-7-18
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

回答(1 个)

Alfonso Nieto-Castanon
data_new = ids(data);

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by