-Perform the calculation of the remaining source activity at time t
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
hello i am doing the calculation of the activity of a radioactive source at any time (t) given the isotope type, the initial activity (A0). The minimum requirements include:
- There is an input box to enter the values A0, t; There is a static text display box (static text) to display text information; there is a button to select the type of radioisotope (according to a given list); There is a “calculate” button to perform the calculation.
I don't have too much expertise in Matlab, so I can only write the lines below, hope everyone can help me with my mistakes and solutions.
Sincere thanks
Tb=readtable('data.xlsx','Range','A1:B17');
for i=1:size(Tb,1)
T=Tb{i,2};
end
if exist('T')
delta_t=t-t0
t1=minutes(delta_t);
A=A0*2^(t1/T)
end
0 commentaires
Réponses (1)
Garv Agarwal
le 10 Juil 2023
Hi Ngọc,
From my understanding, you want to know how one can design GUI to take input and display output based on the input in MATLAB.
You can use the MATLAB App Designer for this purpose. MATLAB App designer allows you to interactively drag and drop various buttons, text fields and selection boxes. You can then add a function to each of those to add the desired functionality.
For Example -
In order to create a calculate button -
% Create CalculateButton
app.CalculateButton = uibutton(app.UIFigure, 'push');
app.CalculateButton.ButtonPushedFcn = createCallbackFcn(app, @CalculateButtonPushed, true);
app.CalculateButton.Position = [174 116 148 70];
app.CalculateButton.Text = 'Calculate';
In order to create a Text field for A0 -
% Create A0EditFieldLabel
app.A0EditFieldLabel = uilabel(app.UIFigure);
app.A0EditFieldLabel.HorizontalAlignment = 'right';
app.A0EditFieldLabel.Position = [137 338 25 22];
app.A0EditFieldLabel.Text = 'A0';
% Create A0EditField
app.A0EditField = uieditfield(app.UIFigure, 'numeric');
app.A0EditField.Position = [177 315 145 68];
MATLAB automatically generates these lines of codes for you when you drag and drop the desired object into the app page.
Then, you need to add a Callback function to give these objects some functionality.
For example, to call a function when the Calculate button is pushed, you must create a function by clicking the callback button in the designer view -
function CalculateButtonPushed(app, event)
% Your Calculation %
end
For more information and a better understanding, I suggest you to go through the App Designer introductory video and the App Building Onramp course -
0 commentaires
Voir également
Catégories
En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!