to print file to particular location
조회 수: 8 (최근 30일)
이전 댓글 표시
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
채택된 답변
Image Analyst
2019년 11월 10일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Entering Commands에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!