I can not create a matrix

1 view (last 30 days)
Muhendisleksi
Muhendisleksi on 27 Mar 2017
Edited: Andrei Bobrov on 27 Mar 2017
BNdog =[23;107;108;23;107;108]
YON_BLNM =[23;107;108]
ri=[0;124.5383;0;32.2448;0;43.2158]
Z =[186.6933;354.4481;111.2320]
Z=[Z;Z]
for i = 1:length(YON_BLNM)
Zi{i} = Z(BNdog==YON_BLNM(i),1);
end
Zi=cell2mat(Zi')
t_den=Zi+ri
t_den = [186.6933; 311.2316; 354.4481; 386.6929; 111.2320; 154.4478]
It is formed in this way. But it has to be this way;
t_den = [111.2320; 154.4478; 354.4481; 386.6929; 186.6933; 311.2316]
Please help me!

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 27 Mar 2017
Edited: Andrei Bobrov on 27 Mar 2017
BNdog =[23;107;108;23;107;108];
YON_BLNM =[23;107;108];
ri=[0;124.5383;0;32.2448;0;43.2158];
Z =[186.6933;354.4481;111.2320];
Z =[Z;Z];
r = reshape(flip(reshape(ri,2,[]),2),[],1);
Y = flip(YON_BLNM);
[~,ii] = ismember(BNdog,Y);
[~,i2] = sort(ii);
t_den = Z(i2) + r;

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!