does not plot the normal distribution. Writes Unrecognized function or variable 'O'. What is the reason?

4 次查看(过去 30 天)
classdef app3 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
Button_4 matlab.ui.control.Button
Button_3 matlab.ui.control.Button
Button_2 matlab.ui.control.StateButton
UITable matlab.ui.control.Table
Image matlab.ui.control.Image
Button matlab.ui.control.Button
UIAxes3 matlab.ui.control.UIAxes
UIAxes2 matlab.ui.control.UIAxes
UIAxes matlab.ui.control.UIAxes
end
% Callbacks that handle component events
methods (Access = private)
% Image clicked function: Image
function ImageClicked(app, event)
[filename,pathname]=uigetfile ({'*.txt'}, 'File Selector');
fullpath=strcat(pathname,filename);
x=readtable(fullpath);
app.UITable.Data=x;
app.UITable.ColumnName=x.Properties.VariableNames;
year=x(:,1);
lat=x(:,2);
lon=x(:,3);
app.O=x(:,4);
end
% Cell edit callback: UITable
function UITableCellEdit(app, event)
end
% Value changed function: Button_2
function Button_2ValueChanged(app, event)
histfit(app.UIAxes, table2array (app.O))

回答(1 个)

Chris
Chris 2021-10-26
app.O is a property that needs to be declared in a properties block before it can be used.
Since it's not declared, an error is thrown when you try to assign or retrieve it.

类别

Help CenterFile 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!

Translated by