No BSD License  

Highlights from
MatPlanWDM v0.5

image thumbnail

MatPlanWDM v0.5

by

 

29 Jan 2007 (Updated )

Educational network planning tool for the RWA problem in WDM networks (MILP and heuristic based)

IO_formatEditString.m
% IO_formatEditString
% 
% Usage: [formattedString] = IO_formatEditString(editString)
%
% Abstract: This function gives the right format a string read from a edit
% text of a GUI ('editString'). A string readed from a edit box is matrix
% 'NrRows x NrCols' without formating, but the functions of the IO Folder
% need a string formatted in the following way: a vector row of characters
% formatted with '/n' after each row of the original string read from the
% edit. We usually use this function to format rightly a 'phys string',
% string of characters equal to a string of a Physical Topology File
% (*.phys), or a 'traff string', string of characters equal to a string of
% a  Traffic File (*.traff)
%
% Arguments:
% o	In: 
% . editString: String readed from a text edit without formatting.
%
% o	Out: 
% 	formattedString: Formatted string to use it in a function of the
%   IO Folder.
%
%
%
%                                       Ramon Aparicio Pardo,2007

function [formattedString] = IO_formatEditString(editString)

%We check input arguments
if (nargin==0),  help IO_formatEditString;return, end %help calling
if (nargin~=1),  error('??? Error using ==> IO_formatEditString. Incorrect number of arguments.'),end %Number of input arguments different of 1

% 'editString' has not the right format: a string readed from a edit
% box is matrix 'NrRows x NrCols' without formating, but a 'formattedString' must
% be formatted as a vector row formatted with /n between the
% rows.

NrRows=size(editString,1);
formattedString=editString(1,:);
for i=2:NrRows ,
    formattedString=[formattedString '\n' editString(i,:)];
end
formattedString=sprintf(formattedString);

Contact us