Files

54 lines
2.6 KiB
Matlab

function nappImage(DataTable,varargin)
%
% no longer used.
% Define conditions and defaults of input
defaultTableVariable = {'image'};
expectedTableVariable = {'image','imageRoh'};
defaultTableSelection = true(size(DataTable,1));
% Parse input
p = inputParser;
addRequired(p,'DataTable',@istable);
addOptional(p,'tableSelection',defaultTableSelection,@islogical);
addParameter(p,'tableVariable',defaultTableVariable,...
@(x) any(validatestring(x,expectedTableVariable)));
parse(p,DataTable,varargin{:});
% check input (all elements of input variable need to have non-zero size)
if ~all(cell2mat(cellfun(@size,p.Results.DataTable(p.Results.tableSelection,:).(p.Results.tableVariable),'UniformOutput',false)),'all')
disp('The table variable appears to be empty. I quit now')
error('The table variable appears to be empty.')
end
for ii = 1:size(p.Results.DataTable(p.Results.tableSelection,:),1)
figure('Name',p.Results.DataTable(p.Results.tableSelection,:).name{ii});
% Create axes
hold(gca,'on');
% Try to plot image with x and y
try
image(p.Results.DataTable(p.Results.tableSelection,:).xRayEkin_eV{ii},p.Results.DataTable(p.Results.tableSelection,:).scientaEkin_eV{ii},...
p.Results.DataTable.(p.Results.DataFieldname){ii},'Parent',gca,'CDataMapping','scaled');
axis(gca,'ij');
set(gca,'Layer','top');
xlim([p.Results.DataTable(p.Results.tableSelection,:).xRayEkin_eV{ii}(1) p.Results.DataTable(p.Results.tableSelection,:).xRayEkin_eV{ii}(end)]);
ylim([p.Results.DataTable(p.Results.tableSelection,:).scientaEkinMin_eV(ii) p.Results.DataTable(p.Results.tableSelection,:).scientaEkinMax_eV(ii)]);
xlabel('Photon energy [eV]')
ylabel('Auger energy [eV]')
% if this does not work, plot without scaling (just with row and column numbers)
catch
image(p.Results.DataTable(p.Results.tableSelection,:).(p.Results.tableVariable){ii},'Parent',gca,'CDataMapping','scaled');
axis(gca,'ij');
set(gca,'Layer','top');
ylim([1 size(p.Results.DataTable(p.Results.tableSelection,:).(p.Results.tableVariable){ii},1)]);
xlim([1 size(p.Results.DataTable(p.Results.tableSelection,:).(p.Results.tableVariable){ii},2)]);
xlabel('# Photon energy, column number')
ylabel('# Auger energy, column number')
end
box(gca,'on');
title(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'Interpreter','none')
end
end