You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Problems with standalone application on a different PC
2 views (last 30 days)
Show older comments
Hi,
I built a standalone application that loads multiple .csv files from a folder, analyzes them and plots a figure. The code and the final application work fine on my PC. When I transfered the application with the data to another PC I am having issues. I installed the Matlab Runtime 2020a version but the plots are all empty and axis settings are not as they should be.
I also noticed that I get an error when I run the application on the PC "fill missing constant must be empty". I do not get this error on the PC where I built the application.
Are these issues related to settings in excel or is something else causing the issue here?
Thanks.
5 Comments
Rik
on 27 Jul 2021
Is that the entire error you're getting? Which program seems to trigger the error?
Are you using Excel to load the csv files? If so, consider using native Matlab file reading capabilities. Since you're using R2020a I would suggest the readlines function.
You could also use the function below to write to a log file to store the error and the trace.
% the unpublished error_ function was minified to make it more compact.
% For minify (version 1.1.0) see https://www.mathworks.com/matlabcentral/fileexchange/84717
% The unaltered documentation can be found below.
%
% Print an error to the command window, a file and/or the String property of an object.
% The error will first be written to the file and object before being actually thrown.
%
% Apart from controlling the way an error is written, you can also run a specific function. The
% 'fcn' field of the options must be a struct (scalar or array) with two fields: 'h' with a function
% handle, and 'data' with arbitrary data passed as third input. These functions will be run with
% 'error' as first input. The second input is a struct with identifier, message, and stack as
% fields. This function will be run with feval (meaning the function handles can be replaced with
% inline functions or anonymous functions).
%
% The intention is to allow replacement of every error(___) call with error_(options,___).
%
% NB: the error trace that is written to a file or object may differ from the trace displayed by
% calling the builtin error function. This was only observed when evaluating code sections.
%
% options.boolean.con: if true throw error with rethrow()
% options.fid: file identifier for fprintf (array input will be indexed)
% options.boolean.fid: if true print error to file
% options.obj: handle to object with String property (array input will be indexed)
% options.boolean.obj: if true print error to object (options.obj)
% options.fcn struct (array input will be indexed)
% options.fcn.h: handle of function to be run
% options.fcn.data: data passed as third input to function to be run (optional)
% options.boolean.fnc: if true the function(s) will be run
%
% syntax:
% error_(options,msg)
% error_(options,msg,A1,...,An)
% error_(options,id,msg)
% error_(options,id,msg,A1,...,An)
% error_(options,ME) %equivalent to rethrow(ME)
%
% examples options struct:
% % Write to a log file:
% opts=struct;opts.fid=fopen('log.txt','wt');
% % Display to a status window and bypass the command window:
% opts=struct;opts.boolean.con=false;opts.obj=uicontrol_object_handle;
% % Write to 2 log files:
% opts=struct;opts.fid=[fopen('log2.txt','wt') fopen('log.txt','wt')];
function error_(v001,varargin),persistent v000,if isempty(v000),v000=func2str(@error_);end,if isempty(v001),v001=f07(struct);end,v001 =f03( v001 ...
);[v002,v003,v004,v005,v006]=f02( varargin{:});if v006,return,end,v007=struct('identifier',v002,'message',v003,'stack',v004);if v001.boolean.obj,...
v008=v003;while v008(end)==10,v008(end)='';end,if any(v008==10),v008=f00(['Error: ' v008]);else,v008=['Error: ' v008];end,for v009=v001.obj(:).',...
try set(v009,'String',v008);catch,end,end,end,if v001.boolean.fid,for v010=v001.fid(:).',try fprintf(v010,'Error: %s\n%s',v003,v005);catch,end,...
end,end,if v001.boolean.fcn,if ismember(v000,{v004.name}),error('prevent recursion'),end,for v011=v001.fcn(:).',if isfield(v011,'data'),try ...
feval(v011.h,'error',v007,v011.data);catch,end,else,try feval(v011.h,'error',v007);catch,end,end,end,end,rethrow(v007),end
function v000=f00(v001,v002),v003=isa(v001,'char');v001=int32(v001);if nargin<2,if any(v001==13),v001=f04(v001,int32([13 10]),int32(-10));
v001(v001==13)=-10;end,v001(v001==10)=-10;else,for v004=1:numel(v002),v001=f04(v001,int32(v002{v004}),int32(-10));end,end,v005=[0 find(v001==...
-10) numel(v001)+1];v000=cell(numel(v005)-1,1);for v004=1:numel(v000),v006=(v005(v004 )+1);v007=(v005(v004+1)-1);v000{v004}=v001(v006:v007);end,...
if v003,for v004=1:numel(v000),v000{v004}= char(v000{v004});end,else,for v004=1:numel(v000),v000{v004}=uint32(v000{v004});end,end,end
function [v000,v001]=f01(v002,v001),if nargin==0,v002=1;end,if nargin<2, v001=dbstack;end,v001(1:v002)=[];if ~isfield(v001,'file'),for v003=...
1:numel(v001),v004=v001(v003).name;if strcmp(v004(end),')'),v005=strfind(v004,'(');v006=v004( (v005(end)+1):(end-1) );v007=v004(1:(v005(end)-2));
else,v007=v004;[v008,v006]=fileparts(v004);end,[v008,v001(v003).file]=fileparts(v007);v001(v003).name=v006;end,end,persistent v009,if ...
isempty(v009),v009=exist('OCTAVE_VERSION','builtin');end,if v009,for v003=1:numel(v001),[v008,v001(v003).file]=fileparts(v001(v003).file);end,...
end,v010=v001;v011='>';v000=cell(1,numel(v010)-1);for v003=1:numel(v010),[v012,v010(v003).file,v013]=fileparts(v010(v003).file);if v003==...
numel(v010),v010(v003).file='';end,if strcmp(v010(v003).file,v010(v003).name),v010(v003).file='';end,if ~isempty(v010(v003).file),...
v010(v003).file=[v010(v003).file '>'];end,v000{v003}=sprintf('%c In %s%s (line %d)\n',v011,v010(v003).file,v010(v003).name,v010(v003).line);v011=...
' ';end,v000=horzcat(v000{:});end
function [v000,v001,v002,v003,v004]=f02(varargin),v004=false;if nargin==1,if isa(varargin{1},'struct') || isa(varargin{1},'MException'),v005=...
varargin{1};if numel(v005)==0,v004=true;[v000,v001,v002,v003]=deal('');return,end,try v002=v005.stack;v003=f01(0,v002);catch,[v003,v002]=f01(3);
end,v000=v005.identifier;v001=v005.message;v006='Error using <a href="matlab:matlab.internal.language.introspective.errorDocCallback(';if ...
isa(v005,'struct') && numel(v001)>numel(v006) && strcmp(v006,v001(1:numel(v006))),v001(1:find(v001==10,1))='';end,else,[v003,v002]=f01(3);[v000,...
v001]=deal('',varargin{1});end,else,[v003,v002]=f01(3);if ~isempty(strfind(varargin{1},'%')),v000='';v007=varargin(2:end);v001=...
sprintf(varargin{1},v007{:});else,v000=varargin{1};v001=varargin{2};if nargin>3,v007=varargin(3:end);v001=sprintf(v001,v007{:});end,end,end,end
function v000=f03(v000),if ~isfield(v000,'boolean'),v000.boolean=struct;end,if ~isfield(v000.boolean,'con') || isempty(v000.boolean.con),...
v000.boolean.con=false;end,if ~isfield(v000.boolean,'fid') || isempty(v000.boolean.fid),v000.boolean.fid=isfield(v000,'fid');end,if ...
~isfield(v000.boolean,'obj') || isempty(v000.boolean.obj),v000.boolean.obj=isfield(v000,'obj');end,if ~isfield(v000.boolean,'fcn') || ...
isempty(v000.boolean.fcn),v000.boolean.fcn=isfield(v000,'fcn');end,end
function v000=f04(v001,v002,v003),v000=v001(:)';if numel(v002)==0,v004=false(size(v001));elseif numel(v003)>numel(v002),...
error('not implemented (padding required)'),else,v004=true(size(v001));for v005=1:numel(v002),v006=find(v001==v002(v005));v006=v006-v005+1;
v006(v006<1)=[];v007=false(size(v004));v007(v006)=true;v004= v004 & v007;if ~any(v004),break,end,end,end,v006=find(v004);if ~isempty(v006),for ...
v005=1:numel(v003),v000(v006+v005-1)=v003(v005);end,if numel(v003)==0,v005=0;end,if numel(v002)>v005,v006=v006(:);v008=(v005+1):numel(v002);v009=...
f05(v006,v008-1);v000(v009(:))=[];end,end,end
function v000=f05(v001,v002),try v000=v001+v002;catch,try v000=bsxfun(@plus,v001,v002);catch,v003=size(v001); v004=size(v002);v001=repmat(v001,...
max(1,v004./v003)); v002=repmat(v002,max(1,v003./v004));v000=v001+v002;end,end,end
function [v000,v001]=f06(v001),persistent v002,if isempty(v002),v002={true,false;1,0;'on','off';'enable','disable';'enabled','disabled'};try ...
v002(end+1,:)=eval('{"on","off"}');catch,end,end,v000=true;try if isa(v001,'char') || isa(v001,'string'),try v001=lower(v001);catch,end,end,for ...
v003=1:size(v002,1),for v004=1:2,if isequal(v001,v002{v003,v004}),v001=v002{1,v004};return,end,end,end,if isa(v001,...
'matlab.lang.OnOffSwitchState'),v001=logical(v001);return,end,catch,end,v000=false;end
function [v000,v001]=f07(v002,v001),if nargin<2,v001=struct;end,if ~isfield(v002,'print_to_con'),v002.print_to_con=[];end,if ~isfield(v002,...
'print_to_fid'),v002.print_to_fid=[];end,if ~isfield(v002,'print_to_obj'),v002.print_to_obj=[];end,if ~isfield(v002,'print_to_fcn'),...
v002.print_to_fcn=[];end,v003=true;v000=struct;v004=v002.print_to_fid;if isempty(v004),v000.boolean.fid=false;else,v003=false;v000.boolean.fid=...
true;v000.fid=v004;for v005=1:numel(v004),try v006=ftell(v004(v005));catch,v006=-1;end,if v004(v005)~=1 && v006==-1,v001.message=...
['Invalid print_to_fid parameter:',char(10),'should be a valid file identifier or 1.'];v000=[];return,end,end,end,v004=v002.print_to_obj;if ...
isempty(v004),v000.boolean.obj=false;else,v003=false;v000.boolean.obj=true;v000.obj=v004;for v005=1:numel(v004),try v007=get(v004(v005),'String' ...
);set( v004(v005),'String','' );set( v004(v005),'String',v007);catch,v001.message=['Invalid print_to_obj parameter:',char(10),...
'should be a handle to an object with a writeable String property.'];v000=[];return,end,end,end,v004=v002.print_to_fcn;if isempty(v004),...
v000.boolean.fcn=false;else,v003=false;try for v005=1:numel(v004),if ~ismember(class(v004(v005).h),{'function_handle','inline'}) || ...
numel(v004(v005).h)~=1,error('trigger error'),end,end,catch,v001.message=['Invalid print_to_fcn parameter:',char(10),...
'should be a struct with the h field containing a function handle,',char(10),'anonymous function or inline function.'];v000=[];return,end,end,...
v004=v002.print_to_con;if isempty(v004),v000.boolean.con=v003;else,[v008,v000.boolean.con]=f06(v004);if ~v008,v001.message=...
['Invalid print_to_con parameter:',char(10),'should be a scalar logical.'];v000=[];return,end,end,end
Konvictus177
on 27 Jul 2021
Edited: Konvictus177
on 27 Jul 2021
Thanks for the information. I will try it out later today.
The procedure I use to install and run the application on the other PC might be wrong so if you could comment on the procedure, that would be great!
- I installed the runtime on the other PC myself.
- I create the application and copy the files to the new PC.
- On the new PC I do not really install anything, I just run the "exe" which is in the following folders "for_redistribution_files_only" or "for_testing".
Am I making the mistake of not installing the application correctly from the "for_redistribution" folder? This application makes use of other functions that I wrote myself. My assumptions: When I run the application directly form the other 2 folders these functions are not installed. They are only installed correctly if I install the from the "for_redistribution" folder.
Any comments would be much appreciated.
Thanks.
Rik
on 27 Jul 2021
Either version should work. The main difference (if I understand correctly) is whether it can download the MCR if it appears to be missing.
You are being very sparse with details. You don't seem to have posted the actual full error message, and you haven't told us anything about which functions you could be using. You only implied you're using Excel in some way. This makes it very difficult to help you.
Konvictus177
on 27 Jul 2021
Hello,
I am using the "readmatrix" function to load the files.
The function I wrote myself is a getPaths2Data function that gives me the filepaths to my files that are read with "readmatrix" for every file.
I was using the fillmissing function and was getting the "fill missing constant must be empty" error. I changed the code so that I am not using this fillmissing function anymore and the application can be executed completely but my acutal figure at the end is empty. So I guess my application is not loading the data on this new PC. On the PC where I built the application, everything works.
When I am at my desk again I will try the logfiles and the things you have mentioned in your post above. However, I still do not really understand why the application is working on my PC where the application was built and not on the other PC.
Thanks.
Konvictus177
on 27 Jul 2021
I was able to solve this. The problem was linked to how I was getting the path and filename to my data files in my data folder.
Answers (0)
See Also
Categories
Find more on Function Creation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)