How can we get an array of ordered pairs from the user?

조회 수: 8 (최근 30일)
jack nn
jack nn 2015년 4월 12일
편집: Walter Roberson 2015년 9월 20일
I wanna get an array of ordered pairs from user, but in this program we dont know the number of ordered pairs(it can be Changeable) ...Is there any way for this?
for example: I have a 512*512 zero image and I want to change this {(234,90),(120,23),(145,243),(255,75)} to one...the user enter this values...How can I get this values as an array
  댓글 수: 2
Geoff Hayes
Geoff Hayes 2015년 4월 12일
Jack - how are you asking the user to provide the ordered pairs? Through a GUI or through command line requests?
jack nn
jack nn 2015년 4월 13일
편집: Walter Roberson 2015년 9월 20일
hi Geoff
through command line requests.Is it possible?

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

답변 (1개)

Jan
Jan 2015년 4월 13일
It would be much easier to provide the data as a script, wuch that you can edit the data and call the function multiple times without the need to type in all data again:
values = [1,2; 4,5; 8,12; 241, 243];
YourFunction(values)
  댓글 수: 1
jack nn
jack nn 2015년 4월 13일
thanks Jan I have an a matrix: m=zeros(512)
I want to get some ordered pairs from user and if the user enter{(2,4),(66,90),...} the value of these element should be 1 in this matrix .after that I can do my function.

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

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by