Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Using horzcat or cat - Easy
Replies: 1   Last Post: Mar 6, 2013 6:26 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Kevin Ellis

Posts: 53
Registered: 11/29/10
Using horzcat or cat - Easy
Posted: Mar 6, 2013 5:49 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.