how to remove the error "Dimensions of matrices being concatenated are not consistent."?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Jan
le 2 Sep 2021
Modifié(e) : Jan
le 2 Sep 2021
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"];
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
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!