MatlabApp compiled .exe execute from Windows command line without GUI overface
1 次查看(过去 30 天)
显示 更早的评论
Hey community.
I have a Matlab GUI compiled as an app where I can insert some options as an ID, Code and Filename which will then do some operations.
Let's assume this example. In the GUI you type in a ID=123456 with the Code=Test and Filename=test.txt. Now I have compiled this app as an executable .exe. When I start the .exe, then the GUI opens and I can insert these parameters and push a button to for example saves the ID and Code into the Filename. Is it possible to do this task with the compiled app, without starting the gui and just executing it from the command-line from Windows?
For example: MyGuiApp.exe --ID 123456 --Code Test --Filename test.txt
In my opening I habe then something like:
classdef MyGuiApp < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = private)
handles % Description
end
methods (Access = private)
% Code that executes after component creation
function myGuiApp_OpeningFcn(app, varargin)
[logic, index] = max(strcmp(varargin,'--ID'));
if logic
app.handles.id = varargin{index+1};
end
[logic, index] = max(strcmp(varargin,'--Code'));
if logic
app.handles.code = varargin{index+1};
end
[logic, index] = max(strcmp(varargin,'--Filename'));
if logic
app.handles.filename = varargin{index+1};
end
saveDataButtonPushed(app);
end
function saveDataButtonPushed(app)
fileID = fopen(app.handles.filename,'w');
fprintf(fileID,[char(num2str(app.handles.id)),':',char(num2str(app.handles.code))]);
fclose(fileID);
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Software Development Tools 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!