Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Using horzcat or cat  Easy
Posted:
Mar 6, 2013 5:49 PM


Hello,
I have an easy problem. My program outputs the following into separate variables, but can be created using these commands (not the issue):
A = [{'Diesel'};{'Gasoline'}]; B = [2;3];
Could someone explain why you cannot horizontally concatenate these two arrays? If I try cat(2,A,B) I get the following:
Error using cat Dimensions of matrices being concatenated are not consistent.
I get the same using horzcat(A,B). All I want is a matrix that looks like:
C =
'Diesel' 2 'Gasoline' 3
But for some reason I cannot figure out how to do something this simple in MatLab. Any help would be much appreciated.
Kevin



