to print file to particular location
5 views (last 30 days)
Show older comments
I was want to save file in a different folder.
print('answer\Case_A','-dpdf','-bestfit'); %works fine
Tried the code below to print file in a for loop and to save each case in a different folder.
cas={'Case_A','Case_B','Case_C','Case_D','Case_E','Case_F','Case_G','Case_H'};
file=strcat('answer\',cas(dataset)); %dataset being loop variable.
print(file,'-dpdf','-bestfit');
Gives error as below:
Error using checkArgsForHandleToPrint
Handle input argument contains nonhandle values.
Error in checkArgsForHandleToPrint
Error in print>LocalCreatePrintJob (line 216)
handles = checkArgsForHandleToPrint(0,
varargin{:});
Error in print (line 38)
[pj, inputargs] =
LocalCreatePrintJob(varargin{:});
Error in TestPSCAD_MM_L1_case (line 52)
print(file,'-dpdf','-bestfit');
0 Comments
Accepted Answer
Image Analyst
on 10 Nov 2019
Try this:
cas = {'Case_A','Case_B','Case_C','Case_D','Case_E','Case_F','Case_G','Case_H'}
outputFolder = fullfile(pwd, '/answer') % or wherever you want.
for k = 1 : length(cas)
baseFileName = sprintf('%s.pdf', cas{k}) % Use braces around k, NOT parentheses.
fullFileName = fullfile(outputFolder, baseFileName)
print(fullFileName,'-dpdf','-bestfit');
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Entering Commands 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!