Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Error using ==> horzcat

Subject: Error using ==> horzcat

From: Eric W

Date: 2 Mar, 2009 20:54:01

Message: 1 of 3

??? Error using ==> horzcat
CAT arguments dimensions are not consistent.

when I try to concatenate a 52x1 logical array to a 52x5 cell array using the command

txt = [plot txt]

I've looked at size() of both - (52x1 and 52x5), and the vertical dimension - along which I want to concatenate, are consistent!

Subject: Error using ==> horzcat

From: Bill Comisky

Date: 2 Mar, 2009 22:15:51

Message: 2 of 3

On Mar 2, 3:54=A0pm, "Eric W" <gm...@ewilliams2006.com> wrote:
> ??? Error using =3D=3D> horzcat
> CAT arguments dimensions are not consistent.
>
> when I try to concatenate a 52x1 logical array to a 52x5 cell array using=
 the command
>
> txt =3D [plot txt]
>
> I've looked at size() of both - (52x1 and 52x5), and the vertical dimensi=
on - along which I want to concatenate, are consistent!

You can't concatenate a logical array and a cell array, assuming plot
is logical and txt is a cell array. If you want the result to be a
cell array, try:

txt =3D [num2cell(plot) txt]

Bill

Subject: Error using ==> horzcat

From: Loren Shure

Date: 2 Mar, 2009 22:35:05

Message: 3 of 3

In article <1f27c38e-013f-4ba5-917f-efdd852ae7e3
@h20g2000yqn.googlegroups.com>, bcomisky@gmail.com says...
> On Mar 2, 3:54=A0pm, "Eric W" <gm...@ewilliams2006.com> wrote:
> > ??? Error using =3D=3D> horzcat
> > CAT arguments dimensions are not consistent.
> >
> > when I try to concatenate a 52x1 logical array to a 52x5 cell array usi=
ng the command
> >
> > txt =3D [plot txt]
> >
> > I've looked at size() of both - (52x1 and 52x5), and the vertical dimen=
sion - along which I want to concatenate, are consistent!
>=20
> You can't concatenate a logical array and a cell array, assuming plot
> is logical and txt is a cell array. If you want the result to be a
> cell array, try:
>=20
> txt =3D [num2cell(plot) txt]
>=20
> Bill
>=20

Also, you would be better off not naming a variable plot as this could=20
clash with the MATLAB function of the same name.

--=20
Loren
http://blogs.mathworks.com/loren

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us