I am having trouble reading textfile data into my app using uigetfile and readtable functions in appdesigner. Kindly assist

21 views (last 30 days)
I am using a pushbutton.userdata option to read the textfiles and i am not sure if thats the right way to do it. Once the data is read in the dialogbox app. it should be passeed to the main app to complete calculations using ode45 integration.
[The data provided is daily for 365days, kindly run the model from the 1st,JAN,2023 to 31st,DEC,2023] i.e choose the start date as January, 1st, 2023 and end date as December, 31st, 2023 under the simulation tab.
I am encountering the following errors when i push the Runmodel button under the simulation tab.
Error while evaluating Button PrivateButtonPushedFcn.
Warning: Failure at t=4.400000e+01. Unable to meet integration tolerances without reducing the step size below the smallest value
allowed (1.136868e-13) at time t.
> In ode45 (line 662)
In IAA_1/RunModelButtonPushed (line 249)
In matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
Attched are the apps and the CWR data (CWR.txt), Rainfalldata(PCP.txt), Wind_data(WND.txt), Humidity_data(HMD.txt), Temperature_data(TMP.txt), Daylighthours(DLH.txt)
Moreover, when i try to write the data i have read, there seems to be mixup. Like CRW data contains TMP data and vice versa. Kindly assist.

Accepted Answer

Voss
Voss on 14 Apr 2024 at 15:27
All of the IAA_1 app's properties that are passed to the second app (T_wout, T_win, Sr, etc.) are initially empty [].
You can either initialize them to non-empty values, e.g., in IAA_1, where they are defined as app properties:
properties (Access = private)
Dialogapp1
T_wout = 27
T_win = 27
Sr = 2
% etc.
Or you can check whether they're empty in the startupFcn of WATER_TMP_Dialogbox_1, and only update the components corresponding to non-empty values:
if ~isempty(T_wout)
app.T_woutEditField.Value=T_wout;
end
if ~isempty(T_win)
app.T_winEditField.Value=T_win;
end
if ~isempty(Sr)
app.srEditField.Value = Sr;
end
% etc.
Or you can do both of those things.
  2 Comments
Daniel
Daniel on 15 Apr 2024 at 23:59
Moved: Voss on 16 Apr 2024 at 1:01
Thank you so much for your response. How about the 'Warning: Failure at t=4.400000e+01. Unable to meet integration tolerances without reducing the step size below the smallest value
allowed (1.136868e-13) at time t.
> In ode45 (line 662)'

Sign in to comment.

More Answers (0)

Categories

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

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!