필터 지우기
필터 지우기

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

조회 수: 2 (최근 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
Muhammad
Muhammad 2021년 9월 2일
>> incorporatingdataset
Dimensions of matrices being concatenated are not consistent.

댓글을 달려면 로그인하십시오.

채택된 답변

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에서 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