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:
Is the vector the same length???

Subject: Is the vector the same length???

From: Ender

Date: 20 May, 2013 21:17:09

Message: 1 of 3

I have a data array:

 flow_rate_low = [1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3];

I also have a large matrix (21,8), but I want to plot specific values.

Chart(21,2:8)

ans =

    4.5000 5.2000 5.9000 6.8000 7.6000 8.6000 9.5000

I would like to plot flow_rate as a function of Chart(21,2:8). I type in:

plot(flow_rate, Chart_low(21,2:8), '-c');


MATLAB says," I'm sorry Ender. I just can't do that." I say," why?", and MATLAB responds:

??? Error using ==> plot
Vectors must be the same lengths.
 
I don't understand how these vectors are different lengths. Is there something I'm missing?

--Ender--

Subject: Is the vector the same length???

From: Nasser M. Abbasi

Date: 20 May, 2013 21:32:11

Message: 2 of 3

On 5/20/2013 4:17 PM, Ender wrote:
> I have a data array:
>
> flow_rate_low = [1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3];
>
> I also have a large matrix (21,8), but I want to plot specific values.
>
> Chart(21,2:8)
>
> ans =
>
> 4.5000 5.2000 5.9000 6.8000 7.6000 8.6000 9.5000
>
> I would like to plot flow_rate as a function of Chart(21,2:8). I type in:
>
> plot(flow_rate, Chart_low(21,2:8), '-c');
>
>
> MATLAB says," I'm sorry Ender. I just can't do that." I say," why?", and MATLAB responds:
>
> ??? Error using ==> plot
> Vectors must be the same lengths.
>
> I don't understand how these vectors are different lengths. Is there something I'm missing?
>
> --Ender--
>


What is Chart_low ?

You showed Chart before, not Chart_low?

Subject: Is the vector the same length???

From: Ender

Date: 20 May, 2013 21:47:07

Message: 3 of 3

"Nasser M. Abbasi" wrote in message <kne4on$ig0$1@speranza.aioe.org>...
> On 5/20/2013 4:17 PM, Ender wrote:
> > I have a data array:
> >
> > flow_rate_low = [1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3];
> >
> > I also have a large matrix (21,8), but I want to plot specific values.
> >
> > Chart(21,2:8)
> >
> > ans =
> >
> > 4.5000 5.2000 5.9000 6.8000 7.6000 8.6000 9.5000
> >
> > I would like to plot flow_rate as a function of Chart(21,2:8). I type in:
> >
> > plot(flow_rate, Chart_low(21,2:8), '-c');
> >
> >
> > MATLAB says," I'm sorry Ender. I just can't do that." I say," why?", and MATLAB responds:
> >
> > ??? Error using ==> plot
> > Vectors must be the same lengths.
> >
> > I don't understand how these vectors are different lengths. Is there something I'm missing?
> >
> > --Ender--
> >
>
>
> What is Chart_low ?
>
> You showed Chart before, not Chart_low?
>


I figured it out. I did the chart earlier in the program, and when I recopied the chart and added new varaibles (e.g. low) I mixed up the variable names. I then tried to plot variables with different lengths.

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