フィルターのクリア

How to extract a negative value from a column vector? App designer

2 ビュー (過去 30 日間)
Giulia Di Giorgio
Giulia Di Giorgio 2023 年 3 月 18 日
コメント済み: Giulia Di Giorgio 2023 年 3 月 18 日
Hello, I programmed an UITable and I want to establish a condition that warns the user when entering values n<0, but I'm not sure how to do it. I tried with the "contain" command but it says "not enought input arguments", I also tried with the "find" command but I don't know how to set the condition with that one. I'll attatch my code and app. Thanks
%Obtener los datos de la tabla
tabla=app.UITable.Data;
M=cell2mat(tabla)
%Obtener las columnas de la tabla
h=M(:,1)
tP=M(:,2)
tT=M(:,3)
k=find(h<0); j=find(tP<0); l=find(tT<0);

採用された回答

Cris LaPierre
Cris LaPierre 2023 年 3 月 18 日
I think you would need to define the CellEditCallback function. This function will execute everytime a cell is edited. You would just to write code to check the value and provide the warning when your condition is met.
  3 件のコメント
Cris LaPierre
Cris LaPierre 2023 年 3 月 18 日
編集済み: Cris LaPierre 2023 年 3 月 18 日
You only need to use newData, as that will be the value the user has entered.
contains is for strings, not numbers. Use a relational operator instead:
if newData<0
% your code here
end
Giulia Di Giorgio
Giulia Di Giorgio 2023 年 3 月 18 日
Thank you Cris, it works perfectly!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by