diff --git a/example.m b/example.m index 4a775d1ad696f8a1cedee90481c27cd21f67faec..f208097f48304f8ca96fbc5dd1907c184233b44a 100644 --- a/example.m +++ b/example.m @@ -1,4 +1,7 @@ -% test skript +%% Example Script +% This Script is meant to demonstrate the capabilities of the PlotID tool. + +%% Clear Environment clear; clc; close all; addpath('fcn_core','fcn_help'); addpath('CI_files'); % Test scripts @@ -7,9 +10,19 @@ try delete testdata_2.h5; end + +%% Set ProjectID +% ProjectID + +% TODO: decide how projectID and optionally ORCID will be implemented +% ORCID placed on startup (alternative?) - projectID as persistent +% otherwise dialogue? ProjectID = 'JL01'; + + + %% Data -% some random data +% Creating Random Data to use as data-file x = linspace(0,7); y = rand(1,100)+2; @@ -31,42 +44,52 @@ h5create(fpath, "/y1", size(y1), "Datatype", class(y1)) h5write(fpath, "/x1", x1) h5write(fpath, "/y1", y1) -%% Plotting -fig(1) =figure; +%% Plotting +% This is still part of a normal script to produce plots. +% Make sure to save each figure in a variable to pass to PlotID-functions. +fig(1) = figure; plot(x,y,'-k'); box off set(gca, 'TickDir', 'out', 'YLim', [0,4]); hold on -%fig(2) =figure; +%fig(2) = figure; plot(x1,y1,'-r'); set(gca, 'TickDir', 'out', 'YLim', [0,4]); + %% Tag the plot +% PlotID Implementation starts here. + [figs, ID] = TagPlot(fig, ProjectID); + + %% call a dummy function +% Place for post-processing of the plot, or additional related code. a=1; a = example_fcn(a); -%% publishing - +%% Publishing +% Second part of plotID % The functions needs the file location, the location of the data and the -% figure +% figure and can take several options. +% TODO add explanations for Options path.script = mfilename('fullpath'); % filename of the m.script -% file name of the data +% file name of the dataset path.rdata = {dataset1,dataset2} ; % don't forget the extension Publish(path, ID, figs, 'Location', 'local','Method','centraliced') %% Second Plot with identical data to test centralized method % -% fig2 =figure; -% plot(x,y,'-k'); -% hold on -% plot(x1,y1,'-r'); -% -% [fig2, ID] = TagPlot(fig2, ProjectID); -% -% Publish(path, ID, fig2, 'Location', 'local','Method','centraliced') \ No newline at end of file + +fig2 =figure; +plot(x,y,'-k'); +hold on +plot(x1,y1,'-r'); + +[fig2, ID] = TagPlot(fig2, ProjectID); + +Publish(path, ID, fig2, 'Location', 'local','Method','centraliced') \ No newline at end of file