All input arguments must be tables error

17 views (last 30 days)
HW
HW on 26 Mar 2020
Answered: Guillaume on 26 Mar 2020
I am new to use Matlab and runing the folloing code but turns out the error "All input arguments must be tables"? Any suggestion would be greatly appreciated. Thanks.
(NT1,T1,NT2,T2 are all 7*1 matrix)
>> A = horzcat(NT1,T1,NT2,T2);
>> C=[A(1,1) A(1,2) A(1,3) A(1,4) 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 A(1,1) A(1,2) A(1,3) A(1,4) 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 A(1,1) A(1,2) A(1,3) A(1,4) 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 A(1,1) A(1,2) A(1,3) A(1,4)
A(2,1) A(2,2) A(2,3) A(2,4) 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 A(2,1) A(2,2) A(2,3) A(2,4) 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 A(2,1) A(2,2) A(2,3) A(2,4) 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 A(2,1) A(2,2) A(2,3) A(2,4)
A(3,1) A(3,2) A(3,3) A(3,4) 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 A(3,1) A(3,2) A(3,3) A(3,4) 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 A(3,1) A(3,2) A(3,3) A(3,4) 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 A(3,1) A(3,2) A(3,3) A(3,4)
A(4,1) A(4,2) A(4,3) A(4,4) 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 A(4,1) A(4,2) A(4,3) A(4,4) 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 A(4,1) A(4,2) A(4,3) A(4,4) 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 A(4,1) A(4,2) A(4,3) A(4,4)
A(5,1) A(5,2) A(5,3) A(5,4) 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 A(5,1) A(5,2) A(5,3) A(5,4) 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 A(5,1) A(5,2) A(5,3) A(5,4) 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 A(5,1) A(5,2) A(5,3) A(5,4)];
%%
All input arguments must be tables.

Answers (1)

Guillaume
Guillaume on 26 Mar 2020
"NT1,T1,NT2,T2 are all 7*1 matrix"
Clearly not! At least one of them is a table. If you concatenate something with a table, as the error tells you all the somethings must be a table.
You can see what class the variables by looking at the class column in the output of:
whos NT1 T1 NT2 T2

Products

Community Treasure Hunt

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

Start Hunting!