I get the following error "Dimensions of arrays being concatenated are not consistent."

1 view (last 30 days)
w20=[2.22939364554e-13,4.39934099226e-10,1.08606937077e-7,
7.8025564785e-6,0.000228338636017,0.00324377334224, 0.0248105208875,
0.10901720602,0.286675505363,0.462243669601,...
0.462243669601,0.286675505363,0.10901720602,0.0248105208875,
0.00324377334224,0.000228338636017,7.8025564785e-6,
1.08606937077e-7,4.39934099226e-10,2.22939364554e-13];
x20=[-5.38748089001,-4.60368244955,-3.94476404012,
-3.34785456738,-2.78880605843,-2.25497400209,-1.73853771212,
-1.2340762154,-0.737473728545,-0.245340708301,...
0.245340708301,0.737473728545,1.2340762154,1.73853771212,
2.25497400209,2.78880605843,3.34785456738,3.94476404012,
4.60368244955,5.38748089001];

Accepted Answer

Alex Mcaulley
Alex Mcaulley on 26 Feb 2020
Are you defining row vectors? Use ... in each line
w20=[2.22939364554e-13,4.39934099226e-10,1.08606937077e-7,...
7.8025564785e-6,0.000228338636017,0.00324377334224, 0.0248105208875,...
0.10901720602,0.286675505363,0.462243669601,...
0.462243669601,0.286675505363,0.10901720602,0.0248105208875,...
0.00324377334224,0.000228338636017,7.8025564785e-6,...
1.08606937077e-7,4.39934099226e-10,2.22939364554e-13];
x20=[-5.38748089001,-4.60368244955,-3.94476404012,...
-3.34785456738,-2.78880605843,-2.25497400209,-1.73853771212,...
-1.2340762154,-0.737473728545,-0.245340708301,...
0.245340708301,0.737473728545,1.2340762154,1.73853771212,...
2.25497400209,2.78880605843,3.34785456738,3.94476404012,...
4.60368244955,5.38748089001];
If they are matrix each row must have the same number of columns

More Answers (0)

Categories

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

Community Treasure Hunt

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

Start Hunting!