필터 지우기
필터 지우기

how to put a list numbers from the user into a matrix in matlab

조회 수: 2 (최근 30일)
brett cursey
brett cursey 2016년 4월 16일
답변: Image Analyst 2016년 4월 16일
Okay, so I want to ask the user for a list of numbers, is there a way to take that list and turn it into a matrix.

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 16일
s=inputdlg('enter your matrix like this [1 2;4 6]');
out=str2num(s{:})
  댓글 수: 2
brett cursey
brett cursey 2016년 4월 16일
so if the user enters something like 5 2 8 9 in a GUI text box. And I like to turn that into a matrix in the form of [5;2;8;9]
Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 16일
a=get(handles.edit1,'string')
b=str2num(a{:})'

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


Image Analyst
Image Analyst 2016년 4월 16일
You can use a uitable. Use GUIDE and place a grid control on it. Then somewhere in your code, stick your data into it like this:
uitable1.data = yourData;
where uitable1 is the "tag" name of your control that you placed on the GUI.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by