Hello,
I saw a coupling topics on this but don’t see a real solution.
Using the MATLAB API I can load a file and create a universal 1 D plot and change config settings. When I open the zmx file after I can see that the settings were applied correctly and the plot looks good. But, I cannot figure out how the access the plot data from the MATLAB API. I’m using:
UnivPlot = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.UniversalPlot1D);
UnivPlot_Settings = UnivPlot.GetSettings();
fprintf('Universal Plot has analysis specific settings? %i\n', UnivPlot.HasAnalysisSpecificSettings)
% Above is False; Universal Plot Settings must be changed via ModifySettings (changing a config (.cfg) file)
cfg = System.String.Concat(TheApplication.ZemaxDataDir, '\Configs\UNI.CFG');
UnivPlot_Settings.Save(); % Create new .cfg file, named "UNI.CFG" in \Configs\ folder
% Change universal plot settings
UnivPlot_Settings.ModifySettings(cfg, 'UN1_CATEGORY', num2str(0));
UnivPlot_Settings.ModifySettings(cfg, 'UN1_PARAMETER', num2str(9));
UnivPlot_Settings.ModifySettings(cfg, 'UN1_SURFACE', num2str(14));
UnivPlot_Settings.ModifySettings(cfg, 'UN1_STARTVAL', num2str(0));
UnivPlot_Settings.ModifySettings(cfg, 'UN1_STOPVAL', num2str(1.26));
UnivPlot_Settings.ModifySettings(cfg, 'UN1_STEPS', num2str(151));
UnivPlot_Settings.ModifySettings(cfg, 'UN1_PAR1', num2str(15));
UnivPlot_Settings.ModifySettings(cfg, 'UN1_OPERAND', 'RSCE');
UnivPlot_Settings.LoadFrom(cfg); % Load in the Universal Plot Settings
% Save and close
TheSystem.Save();
% Run Analysis (THIS IS THE PART THAT DOESN”T WORK)
% UnivPlot.ApplyAndWaitForCompletion();
% UnivPlot_Results = UnivPlot.GetResults();
I’d like to be able to plot as follow:
Read and plot data series
% dataSeries = UnivPlot_Results.DataSeries;
% cc=lines(double(UnivPlot_Results.NumberOfDataSeries));
% for gridN=1:UnivPlot_Results.NumberOfDataSeries
% data = dataSeries(gridN);
% y = data.YData.Data.double;
% x = data.XData.Data.double;
% plot(x,y(:,1),'-','color',cc(gridN,:));
% plot(x,y(:,2),':','color',cc(gridN,:));
% end
Does anyone know how to get the universal plot results from MATLAB? I can plot in any format I can get them in.
Any help is much appreciated.
Thanks,
islandoptics