Clear Filters
Clear Filters

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

4 views (last 30 days)
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))

Answers (1)

Chris
Chris on 26 Oct 2021
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.

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!