how to remove the error "Dimensions of matrices being concatenated are not consistent."?

1 次查看(过去 30 天)
clc
clear all
for i6=1:length(nrotName)
% infileName(i1)= snameExt,nfileName(i1),nmovName(i2),nrepName(i3),nfTime(i4),ndataName(i7),nsegName(i5),nrotName(i6);
% infileName(i1) = dataset.(nfileName).(nmovName).(nrepName).(nfTime).(nsegName).(nrotName).jointAngle;
infileName = dataset.(fileName{i1}).(movName{i2}).(repName{i3}).(nfTime{i4}).(nsegName{i5}).(nrotName{i6}).(jointAngles);
for k = 1: length(infileName)
A=[];
B=[];
B(k)= (infileName(k));
x = linspace(0, 100, length((B(k))));
y = 1:100;
A(k) = spline(x, [B(k) y]);
normalized.(infileName(k))=(A(k));
end
end
end
end
end
end
end
error is coming
Dimensions of matrices being concatenated are not consistent.
  3 个评论

请先登录,再进行评论。

采纳的回答

Jan
Jan 2021-9-2
编辑:Jan 2021-9-2
I guess, the error occurs in this line:
nsegName= ["L5S1","L3L4","T12L1","T8T9","C7T1","C1Head","RT4Shoulder","RShoulder","RElbow","RWrist","LT4Shoulder","LShoulder","LElbow","LWrist",
"RHip","RKnee","RAnkle","RBallFoot","LHip","LKnee","LAnkle","LBallFoot"];
Error using vertcat
Dimensions of arrays being concatenated are not consistent.
The problem is the missing line continuation at the end. Append a "...":
nsegName = ["L5S1","L3L4","T12L1","T8T9","C7T1","C1Head","RT4Shoulder","RShoulder", ...
"RElbow","RWrist","LT4Shoulder","LShoulder","LElbow","LWrist", ...
"RHip","RKnee","RAnkle","RBallFoot","LHip","LKnee" ,"LAnkle","LBallFoot"];
Your code can be simplified:
nfileName = "Mert";
load('dataset.mat')
nmovName = "AOG"; %,'FUZ','FUZY','MaW','NoW','OAK'};
nrepName = ["Bir", "iki", "uc"];
nfTime = ["TO"];%'TS'};
nsegName = ["L5S1","L3L4","T12L1","T8T9","C7T1","C1Head", ...
"RT4Shoulder","RShoulder","RElbow","RWrist","LT4Shoulder", ...
"LShoulder","LElbow","LWrist", "RHip","RKnee","RAnkle", ...
"RBallFoot","LHip","LKnee","LAnkle","LBallFoot"];
nrotName = ["_x","_y","_z"];
for i1 = 1:length(nfileName)
for i2 = 1:length(nmovName)
for i3 = 1:length(nrepName)
for i4 = 1:length(nfTime)
for i5 = 1:length(nsegName)
for i6=1:length(nrotName)
infileName = dataset.(fileName{i1}).(movName{i2}).(repName{i3}).(nfTime{i4}).(nsegName{i5}).(nrotName{i6}).(jointAngles);
for k = 1: length(infileName)
B = infileName(k);
x = linspace(0, 100, length(B));
y = 1:100;
A = spline(x, [B, y]);
normalized.(infileName(k)) = A;
end
end
end
end
end
end
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Function Handles 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by