MATLAB编辑字段不接受打印值

问题描述 投票:0回答:1

我尝试分配...时显示错误,

app.WBCCount = app.WBC_Count;

错误是...

类'zia'的错误设置属性'WBCCount':无法将双精度值76转换为句柄

当我按下名为“ countWBCButton”的按钮时,将调用一个函数。这是发生错误的功能...

% Button pushed function: CountWBCButton
    function CountWBCButtonPushed(app, event)

        if app.c ==1
            app.WBCCount = app.WBC_Count;  %Error Error Error Error.....
        else
            msgbox('First segment WBC','Error' , 'error');
        end
    end

上面的函数中带有错误的注释行显示错误

WBCCount

WBCCount is a public property. It's properties are given in below picture..

matlab variable-assignment handle
1个回答
0
投票

错误是不言自明的:WBCCounthandle,而app.WBC_Countdouble

您正在尝试将double的值直接置于WBCCount,而不是设置WBCCount的相关属性。

如果app.WBCCount属于matlab.ui.control.NumericEditField类,请使用:

app.WBCCount.Value = app.WBC_Count;

[如果app.WBCCount属于matlab.ui.control.Labelmatlab.ui.control.EditField类别,请使用:

app.WBCCount.Text = num2str(app.WBC_Count);

您可以在应用程序的“代码视图”的app.WBCCount部分下检查properties (Access = public)的类别。

注:就像rinkert提到的那样,您没有提供足够的信息来获得好的答案,所以我不得不作一些猜测...

© www.soinside.com 2019 - 2024. All rights reserved.