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
Alfonso Nieto-Castanon 2014년 7월 18일
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