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

Can anyone help me plz ???

Asked by Anas Blue on 3 Jul 2013

I wrote this code but I can't plot anything and there

prompt={'Enter Th Number Of Lines:'};

title='Draw Line ';

n=inputdlg(prompt);

A= cell2mat(n);

[x,y] = ginput(A);

plot(x,y)

0 Comments

Anas Blue

Tags

Products

No products are associated with this question.

1 Answer

Answer by Wayne King on 3 Jul 2013
Edited by Wayne King on 3 Jul 2013
Accepted answer
    prompt={'Enter The Number Of Lines:'};
    title='Draw Line ';
    n=inputdlg(prompt);
    A = str2num(cell2mat(n));
    [x,y] = ginput(A);
    plot(x,y)

3 Comments

Anas Blue on 3 Jul 2013

Thanks dude

Anas Blue on 4 Jul 2013

Bro can I save the (x, y) in array or each one of them in a single array ??? And thanks

Jan Simon on 4 Jul 2013

"title" is a Matlab command and shadowing it by a variable can cause unexpected troubles.

A simplification:

A = sscanf(n{1}, '%d');

You can store x and y in one array:

data = [x, y];
Wayne King

Contact us