How to extract a negative value from a column vector? App designer
1 次查看(过去 30 天)
显示 更早的评论
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1328675/image.jpeg)
%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);
0 个评论
采纳的回答
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
2023-3-18
编辑:Cris LaPierre
2023-3-18
You only need to use newData, as that will be the value the user has entered.
if newData<0
% your code here
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!