Need help creating a matrix that updates based on input to a GUI

조회 수: 2 (최근 30일)
Rusty
Rusty 2012년 5월 24일
I am creating a GUI that allows users to input 3 data points through edit text boxes. The user will then click a push button and the data will be added to a matrix.
Currently, the matrix is a 3 by 1 and every time the push button is clicked, the old data is erased and the new data replaces it.
I need to know how to have the matrix add a column each time new data is entered and the push button is clicked.
I tried using the "." after the matrix variable name and MATLAB didn't like it.
Can anyone help with this?

채택된 답변

Stephen
Stephen 2012년 5월 24일
what if you did this:
matrix = [matrix; (button input)];
so m = [1 2 3] would go to
m = [1 2 3; 4 5 6]
with [4 5 6] as the input
  댓글 수: 2
Rusty
Rusty 2012년 5월 25일
I think this will work, I just need to move some things around. Thanks for your help!!!
Stephen
Stephen 2012년 5월 25일
just remember to clear the value before running things again.
m=[]; at initialization

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by