フィルターのクリア

MatlabApp compiled .exe execute from Windows command line without GUI overface

2 ビュー (過去 30 日間)
Ingo Hermann
Ingo Hermann 2022 年 6 月 10 日
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 件)

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by