Making Paper Position Variable depending on Machine
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Oleg Komarov
el 8 de Ag. de 2012
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.
Respuesta aceptada
Daniel Shub
el 8 de Ag. de 2012
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 comentarios
Oleg Komarov
el 8 de Ag. de 2012
Editada: Oleg Komarov
el 8 de Ag. de 2012
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
el 8 de Ag. de 2012
Editada: Oleg Komarov
el 8 de Ag. de 2012
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
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!