I can not create a matrix

1 次查看(过去 30 天)
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!

采纳的回答

Andrei Bobrov
Andrei Bobrov 2017-3-27
编辑:Andrei Bobrov 2017-3-27
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;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by