Passing Data located on a Vector (or Matrix) Variable from one GUI to another

조회 수: 2 (최근 30일)
Hello everyone
I am using the AppDesigner in order to create a program where two interfaces are connect through a botton. It is supposed that once I type the values on their EditField, they are put in the vector (with defined dimensions from the beggining) where I will hold all the typed data from both interfaces. Also, I would like that the user can come back to the first interface to correct a mistake if needed.
However, it seems like the Second GUI is not receiving the information and I get the following Error message
Error using GREET_2020_Interface_2/startupFcn (line 35)
Unrecognized method, property, or field 'SIDICAGasolineEditField' for class 'GREET_2020_Interface_2'.
Error in GREET_2020_Interface_2 (line 166)
runStartupFcn(app, @(app)startupFcn(app, varargin{:}))
Which is located on the following code section
function NextButtonPushed(app, event)
InputVehicles=zeros(85,1);
InputVehicles(1)=app.SIGasolineEditField.Value;
...
InputVehicles(21)=app.SIHighOctaneFuelE40EditField.Value;
GREET_2020_Interface_2(InputVehicles);<-------------ERROR MESSAGE APPEARS
delete(app);
The Second Interface should receive the InputVehicles as it is indicated below:
properties (Access = private)
PreviousInputs <-----It will hold the upcoming values of Interface 1
end
methods (Access = private)
function startupFcn(app, InputVehicles)
app.PreviousInputs=InputVehicles;
app.SIDIGasolineEditField.Value=InputVehicles(22);
Please, I need your help. I am open to hear alternatives to solve this. I tried to watch YouTube videos but they seem to use an old AppDesigner version. Thank you

답변 (1개)

Shravan Kumar Vankaramoni
Shravan Kumar Vankaramoni 2021년 10월 7일
편집: Shravan Kumar Vankaramoni 2021년 10월 7일
Hi,
I understand that you are having issue in transferring data among apps. So, Here is the example that illustrates that functionality.
In the attached file, you will find "choosedialog" function which creates a new app and asks to choose a color, which is sent to the main app once this dialog closes. Below is the code for main app:
function EnterColorsButtonPushed(app, event)
set(app.UIFigure.Children, 'Enable', 'off');
try
% call to second app which returns a value
c = choosedialog(app);
catch ME
c = "Red";
end
%storing the value returned from second app into main app local
%variable
app.colorData = c;
set(app.UIFigure.Children, 'Enable', 'on');
end
For more information, visit the below links:
Hope this helps to resolve your issue.

카테고리

Help CenterFile Exchange에서 Software Development Tools에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by