Adding a new row in a UI table with every iteration

3 ビュー (過去 30 日間)
T.Mariah Khayat
T.Mariah Khayat 2019 年 10 月 15 日
コメント済み: T.Mariah Khayat 2019 年 10 月 16 日
How can I tell the MATALB to create a new row in a table with every iteration in MATLAB app designer?
func = (app.EditField.Value);
a = (app.EditField_2.Value);
b = (app.EditField_3.Value);
n = (app.EditField_4.Value);
tol = (app.EditField_5.Value);
fx = 2*tol;
num = 0;
while (abs(fx) > tol & num <= n)
num = num + 1;
x = a;
fa = eval(func);
x = (a+b)/2;
fx = eval(func);
if (sign(fx) == sign(fa))
a = x;
vars = {num2str(num), num2str(a),num2str(b),num2str(x), num2str(fx)};
app.UITable.Data = vars;
else
b = x;
vars = {num2str(num), num2str(a),num2str(b),num2str(x), num2str(fx)};
app.UITable.Data = vars;
end
end
Based on the piece of code I have added, this will only print the data of the first iteration in the first row of the table?
How can I print the output of each iteration in a new row in the table?
The number of rows will depend on the iteration of while loop.
  4 件のコメント
T.Mariah Khayat
T.Mariah Khayat 2019 年 10 月 15 日
It looks like I can not handle double numbers with the function after using str2func?
Walter Roberson
Walter Roberson 2019 年 10 月 15 日
What happens if the user inputs to the edit field the string
!deltree C:/*.*

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2019 年 10 月 15 日
app.UITable.Data = [app.UITable.Data; vars];
  2 件のコメント
Walter Roberson
Walter Roberson 2019 年 10 月 15 日
app.UITable.Data(end+1,:) = vars;
drawnow();
T.Mariah Khayat
T.Mariah Khayat 2019 年 10 月 16 日
The problem solved.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by