Skip to content

Commit

Permalink
#7 Added xp_matrix_advancedplot3D.m
Browse files Browse the repository at this point in the history
  • Loading branch information
davestanley committed Mar 20, 2017
1 parent 0f21585 commit e952066
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions library_plots/xp_matrix_advancedplot3D.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@


function xp_matrix_advancedplot3D (xp, op)
% xp must be 1x1 (e.g. 0 dimensional)


if nargin < 2
op = struct;
end

if isempty(op); op = struct; end;

op = struct_addDef(op,'xlims',[]);
op = struct_addDef(op,'ylims',[]);
% op = struct_addDef(op,'shift_val',[]);

xlims = op.xlims;
ylims = op.ylims;
% shift_val0 = op.shift_val;

if ~isempty(xp.meta.datainfo(1).values)
t = xp.meta.datainfo(1).values;
else
t = 1:length(xp.data{1});
end

d = xp.data{1};
if ismatrix(d)
plot(t,d);
elseif ndims(d) == 3
for i = 1:size(d,3)
hold on; plot(t,d(:,:,i));
end
else
error('Too many dimensions');
end

if ~isempty(xlims); xlim(xlims); end
if ~isempty(ylims); ylim(ylims); end

end


0 comments on commit e952066

Please sign in to comment.