Matlab assigns "export options" & # 8594; "download options from" for numbers programmatically

I have some curly styles that I saved in the Export Settings dialog box, which can be accessed from the File menu β†’ Export Settings.

Is there a way to programmatically load one of my styles? i.e. Currently, I need to make a few clicks to load my desired style, and then apply it to the shape, and then report it to export and give the file a name. I feel that all this should be done with a few commands, but I cannot find the information I need.

+5
source share
3 answers

:

 % create an example fig that we want to format with style file 'foo'
 plot(rand(14,10));

 % get style sheet info
 snam='foo'; % The name of your style file (NO extension)
 s=hgexport('readstyle',snam);

 %apply style sheet info
 fnam='myfig.jpeg'; % your file name
 s.Format = 'jpeg'; %I needed this to make it work but maybe you wont.
 hgexport(gcf,fnam,s);

"myfig.jpeg", , "foo". , s . , , .

s = 

            Version: '1'
             Format: 'jpeg'
            Preview: 'none'
              Width: 'auto'
             Height: 'auto'
              Units: 'points'
              Color: 'rgb'
         Background: 'w'
      FixedFontSize: '10'
     ScaledFontSize: 'auto'
           FontMode: 'scaled'
        FontSizeMin: '8'
     FixedLineWidth: '1'
    ScaledLineWidth: 'auto'
           LineMode: 'scaled'
       LineWidthMin: '2'
           FontName: 'Wingdings'
         FontWeight: 'auto'
          FontAngle: 'auto'
       FontEncoding: 'latin1'
            PSLevel: '2'
           Renderer: 'auto'
         Resolution: 'auto'
       LineStyleMap: 'none'
         ApplyStyle: '0'
             Bounds: 'loose'
           LockAxes: 'on'
             ShowUI: 'on'
       SeparateText: 'off'
+7

"SDF" MATLAB. . sdf.m . .

figure;
hold on;
plot(rand(1,100));
plot(rand(1,100), 'r');
grid on;
box on;
sdf('mystyle');          %"mystyle" is the name of export style

http://www.mathworks.com/matlabcentral/fileexchange/24807-sdf-set-the-figure

+3

.

" " MATLAB. cd(fullfile(prefdir, 'ExportSetup')), . " " , , .

, , .

, , (File->Generate Code .). .

Hope this helps.

0
source

All Articles