function varargout = metadataWhatIfFigure(varargin)
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help columnNormalization
% Last Modified by GUIDE v2.5 16-Oct-2007 21:28:32
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @metadataWhatIfFigure_OpeningFcn, ...
'gui_OutputFcn', @metadataWhatIfFigure_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before metadata is made visible.
function metadataWhatIfFigure_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to metadata (see VARARGIN)
% Choose default command line output for metadata
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes metadata wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = metadataWhatIfFigure_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%pushbuttonSaveXML -
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = pushbuttonSaveMetadata_Callback(h, eventdata, handles, varargin)
load_global_WhatIf;%Global variables are loaded
%We open the file to save our XML file (*.xml)'
metadata = struct('title', get(handles.editTitle,'String'), 'author', get(handles.editAuthor,'String'), 'date', datestr(now), 'multihourPlanning', ['false'],...
'planningAlgorithmFile', [], 'planningAlgorithmParametersString', [], 'flowGeneratorFile', [''],...
'flowGeneratorParametersString', [''], 'trafficMatrixFile', trafficFilename, 'description', get(handles.editDescription,'String'));
directoryname = uigetdir('data\results\whatIfAnalysis\', 'Select a Directory to save the What-If XMLs (*.xml)');
% [filename, pathname] = uiputfile({'*.xml','Extensible Markup Language File (*.xml)'},'Save XML File','data\results\whatIfAnalysis\');
% fullpathname=[pathname filename];
DTDpathname = '../../dtd/vtDesign.dtd';
%NOTE: the pathname can be different
k=0;
for n=1:size(listOfMethodsString,1),
currentMethodString=listOfMethodsString{n};
indecesOfSpaces=find(currentMethodString==' ');
method=currentMethodString(indecesOfSpaces(1)+1:indecesOfSpaces(2)-1);
algorithmParameters=currentMethodString(indecesOfSpaces(3)+1:end);
%We sweep the parameters
for i=1:firstSweepNrPoints,
for j=1:secondSweepNrPoints,
k=k+1;
metadata.planningAlgorithmFile = method;
metadata.planningAlgorithmParametersString = algorithmParameters;
fullpathname = [directoryname , '\' , metadata.title ,'_', num2str(k) , '_' , num2str(size(listOfMethodsString,1)*firstSweepNrPoints*secondSweepNrPoints),'.xml'];
io_writeXML(metadata, SweepOfPhys{i,j}, SweepOfNetState{i,j,n}, fullpathname, DTDpathname);
end
end
end
close;