필터 지우기
필터 지우기

Making Paper Position Variable depending on Machine

조회 수: 3 (최근 30일)
James hall
James hall 2012년 8월 8일
I have found an issue with generating plot pdfs where the the smae script used on different computers requires different alignement parameters inorder to fit the plots on one A4 sheet
I have created a prompt box to ask which machine is being used and it selects the variable but it does not insert it into the code
**********************************************************
%% Laptop or Workstation Analysis
orientation={ '[0.05, 0.1, 12, 8]' '[0.1, 0.1,30, 20]'};% These are the plot size parameters
prompt= ' Plese Select Computer'; 'Workstation = 1'; 'Laptop = 2';
name = ' Select Computer Type';
option = str2double(inputdlg(prompt,name,2,{'1'}));
if option >= 1 && option <= 2
O = orientation{option};
end
********************************************************
set(gcf,'defaulttextinterpreter','none','Visible','off','PaperOrientation', 'landscape','PaperPositionMode','manual', 'PaperPosition','O')
***********************************************************
Does any one have any ideas that would solve this
Many Thanks In Advance
James
  댓글 수: 1
Oleg Komarov
Oleg Komarov 2012년 8월 8일
Please use comments and not answers unless you found a solution to your problem.
Also DO NOT accept your own answer if a contributor solved your problem.

댓글을 달려면 로그인하십시오.

채택된 답변

Daniel Shub
Daniel Shub 2012년 8월 8일
Your posted code seems to have a couple of bugs. You create orientation as a cell array of strings and eventually pass one of those strings as the value of PaperPosition, but PaperPosition was a numeric array. Also, asking for the computer is probably not best. You can get it automatically with the OS hostname function (Windows and most Linux distros supply this function). Putting it all together ...
orientation = [0.05, 0.1, 12, 8; 0.1, 0.1,30, 20];
computerNames = {'WorkstationName'; 'LaptopName'};
[~, thiscomputer] = system('hostname');
option = strcmp(deblank(thiscomputer), computerNames);
set(gcf,'defaulttextinterpreter','none','Visible','off','PaperOrientation', 'landscape','PaperPositionMode','manual', 'PaperPosition',orientation(option, :))
  댓글 수: 2
Oleg Komarov
Oleg Komarov 2012년 8월 8일
편집: Oleg Komarov 2012년 8월 8일
First and accepted answer by James Hall moved to comment.
the issue that I am facing is that the code is there to reduce the need to change the code just to apply variables. It isnt guarunteed which computers will be using the script. thats why I was hoping to just use a input selection.
The script is intended for the non technical user just be able to pretty mindlessly process vast amounts of data on a weekly basis. I wouldnt be there to change the script to include different computers in the script.
or would the proposed script deal with that issue aswell?
many thanks for your reply
Oleg Komarov
Oleg Komarov 2012년 8월 8일
편집: Oleg Komarov 2012년 8월 8일
Second answer by James Hall moved here as comment.
I have utilised your script as you said, and written a read me to make the new users add their system to the list computer names and spec.
thank you very much

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by