[問題] 關於while迴圈的問題

看板MATLAB作者 (thomas宗)時間12年前 (2013/04/06 19:56), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
n_points = input('Enter the number of input [x y] points: '); while n_points <= 0 && n_points > 0 n_points = input('Enter the number of input [x y] points: '); isempty (n_points); end % Read the input data for ii = 1:n_points temp = input('Enter [x y] pair: '); x(ii) = temp(1); y(ii) = temp(2); end 題目說修改程式使用一個while迴圈,以便能讀取任意數目的資料值,要求 當輸入者為輸入任何值時,而直接點及Enter鍵時,便停止讀取任何資料 對於while迴圈內的判斷式以及條件式的打法要怎麼打會比較好? (使用函式isempty來測試是否讀取到一個空陣列) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.135.33.155
文章代碼(AID): #1HO0rKVx (MATLAB)