MATLAB Answers

how to add element in vector?

4 views (last 30 days)
Rohit Bhoi
Rohit Bhoi on 28 Feb 2016
Commented: Jan on 28 Feb 2016
I have a gui in which there is one edit text box and two buttons namely add and save. I have created on blank vector as v=[]; whenever user press add the value of edit text should be added to the vector? how to do that?

  0 Comments

Sign in to comment.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 28 Feb 2016
v=[]
a=10
v=[v a]

  3 Comments

Rohit Bhoi
Rohit Bhoi on 28 Feb 2016
Thanks sir. need one more help that how to share vector between two function?
Azzi Abdelmalek
Azzi Abdelmalek on 28 Feb 2016
use guidata function
Jan
Jan on 28 Feb 2016
@Azzi: I think the code is meaningless, because the v does not have any effects here. The OP inserted this exactly as posted into his code, such that v=10 is performed in every case.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!