Changeset 500 for trunk


Ignore:
Timestamp:
Jul 24, 2012, 7:58:33 PM (12 years ago)
Author:
sommeria
Message:

various bug corrections

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/PARAM.xml.default

    r499 r500  
    1010<Civ2Bin>bin/civ2<!--binary for civ2 (relative or absolute path)
    1111--></Civ2Bin>
    12 <CivmBin>bin/run_civ_matlab.sh<!--binary from compilation of civ_matlab.
     12<CivmBin>civ_matlab.sh<!--binary from compilation of civ_matlab.
    1313m (relative or absolute path)--></CivmBin>
    1414<Civ3D3CBin>bin/civ3d3c</Civ3D3CBin>
     
    2323<Civ1Bin>bin/civ1</Civ1Bin>
    2424<Civ2Bin>bin/civ2</Civ2Bin>
    25 <CivmBin>bin/run_civ_matlab.sh<!--binary from compilation of civ_matlab.
     25<CivmBin>civ_matlab.sh<!--binary from compilation of civ_matlab.
    2626m (relative or absolute path)--></CivmBin>
    2727<Civ3D3CBin>bin/civ3d3c</Civ3D3CBin>
  • trunk/src/civ.m

    r498 r500  
    2424%TODO: search range
    2525
    26 % Last Modified by GUIDE v2.5 18-Jul-2012 23:20:12
     26% Last Modified by GUIDE v2.5 24-Jul-2012 13:14:00
    2727% Begin initialization code - DO NOT EDIT
    2828gui_Singleton = 1;
     
    5959addpath (path_civ) ; %add the path to civ, (useful in case of change of working directory after civ has been s opened in the working directory)
    6060errormsg=[];%default error message
    61 xmlfile='PARAM.xml';
     61xmlfile=fullfile(path_civ,'PARAM.xml');
    6262test_batch=0;%default: ,no batch mode available
    6363sparam=[];
     64if ~exist(xmlfile,'file')
     65    [success,message]=copyfile(fullfile(path_civ,'PARAM.xml.default'),xmlfile)
     66end
    6467if exist(xmlfile,'file')
    6568    try
     
    7174    end
    7275else
    73     %errormsg=[xmlfile ' not found: path to civx binaries undefined'];
    7476    [s,w]=system('oarstat');
    7577    if ~isequal(s,0)
     
    9092    end
    9193    if ~isempty(test_command)
    92     [s,w]=system(test_command);
    93     if isequal(s,0)
    94         test_batch=1;
    95     end
     94        [s,w]=system(test_command);
     95        if isequal(s,0)
     96            test_batch=1;
     97        end
    9698    end
    9799end
     
    360362    % settings for  new civ data,
    361363    if strcmp(Data.Conventions,'uvmat/civdata')% case of new civ data,
    362         set(handles.Program,'Value',2) %select civ/Matlab by default
     364        set(handles.Program,'Value',1) %select civ/Matlab by default
    363365        Program_Callback([],[], handles)
    364366        if ~isempty(Data.CivStage)%test for civ files
     
    376378        % settings for civx data,
    377379    elseif ~isempty(Data.absolut_time_T0')% case of  civx data,
    378         set(handles.Program,'Value',1) %select Cix by default
     380        set(handles.Program,'Value',3) %select Cix by default
    379381        Program_Callback([],[], handles)
    380382        if ~isempty(Data.fix2)
     
    10801082%% read the PARAM.xml file to get the binaries (and batch_mode if batch)
    10811083path_civ=fileparts(which('civ')); %path to the source directory of uvmat
    1082 xmlfile='PARAM.xml';
     1084xmlfile=fullfile(path_civ,'PARAM.xml');
    10831085s=[];
    10841086if exist(xmlfile,'file')% search parameter xml file in the whole matlab path
     
    11521154            else
    11531155                errormsg=['path ' path ' for binaries defined in PARAM.xml does not exist'];
    1154                 return
    1155             end
    1156            
     1156            end         
    11571157        else  %look for the full path if the file name has been defined with a relative path in PARAM.xm
    11581158            fullname=fullfile(path_civ,Param.xml.(bin_name{1}));
     
    11611161            else
    11621162                errormsg=['Binary ' Param.xml.(bin_name{1}) ' defined in PARAM.xml does not exist'];
    1163                 return
    1164             end
    1165         end
    1166     end
     1163            end
     1164        end
     1165    end
     1166end
     1167if ~isempty(errormsg)
     1168    if strcmp(Param.Program,'civ_matlab.sh')
     1169        errormsg=[{errormsg}; {'run compile_functions.m to create it by compiling civ_matlab.m'}];
     1170    end
     1171    return
    11671172end
    11681173
     
    45614566
    45624567function last_i_Callback(hObject, eventdata, handles)
    4563 
  • trunk/src/fill_GUI.m

    r497 r500  
    1717% loop on the elements of the input structure Param
    1818for ifield=1:numel(fields)
    19     if isstruct(Param.(fields{ifield}))% case of sa sub-structure
     19    % case of a sub-structure --> fill a panel
     20    if isstruct(Param.(fields{ifield}))% case of a sub-structure
    2021        if isfield(handles,fields{ifield})
    2122            set(handles.(fields{ifield}),'Visible','on')
     
    2627            errormsg=fill_GUI(Param.(fields{ifield}),hchild);% apply the function to the substructure
    2728        end
     29    % case of an element
    2830    else
    2931        hh=[];
    3032        input_data=Param.(fields{ifield});
     33                    display(fields{ifield})
     34                    display(input_data)
    3135        check_done=0;
    3236        if isfield(handles,fields{ifield})
     
    4044                check_done=1;
    4145            end
    42         elseif isnumeric(input_data) && isfield(handles,['num_' fields{ifield}])
    43             hh=handles.(['num_' fields{ifield}]);
     46        elseif isnumeric(input_data)
     47            if numel(input_data)>1
     48                %deals with array displayed in multiple boxes labeled by an index
     49                for ibox=1:numel(input_data)
     50                    if isfield(handles,['num_' fields{ifield} '_' num2str(ibox)])
     51                        hh(ibox)=handles.(['num_' fields{ifield} '_' num2str(ibox)]);
     52                    end
     53                end
     54            else % single box (usual case)
     55               if isfield(handles,['num_' fields{ifield}])
     56                   hh=handles.(['num_' fields{ifield}]);
     57               end
     58            end
    4459        end
    45         if ~isempty(hh)&& ~check_done
    46             set(hh,'Visible','on')
     60        for ibox=1:numel(hh)
     61        if ~isempty(hh(ibox))&& ~check_done
     62            set(hh(ibox),'Visible','on')
    4763%             input_data
    48             switch get(hh,'Style')
     64            switch get(hh(ibox),'Style')
    4965                case {'checkbox','radiobutton','togglebutton'}
    5066                    if isnumeric(input_data)
    51                         set(hh,'Value',input_data)
     67                        set(hh(ibox),'Value',input_data(ibox))
    5268                    end
    5369                case 'edit'
    5470                    if isnumeric(input_data)
    55                         input_data=num2str(input_data);
     71                        input_string=num2str(input_data(ibox));
     72                    else
     73                        input_string=input_data;
    5674                    end
    57                     set(hh,'String',input_data)
     75                    set(hh(ibox),'String',input_string)
    5876                case{'listbox','popupmenu'}
    5977                    if isnumeric(input_data)
    6078                        input_data=num2str(input_data);
    6179                    end
    62                     menu=get(hh,'String');
     80                    menu=get(hh(ibox),'String');
    6381                    if ischar(input_data)
    6482                        input_data={input_data};
     
    7492                        end
    7593                    end
    76                     set(hh,'String',menu)
    77                     set(hh,'Value',values)
     94                    set(hh(ibox),'String',menu)
     95                    set(hh(ibox),'Value',values)
    7896            end
     97        end
    7998        end
    8099    end
Note: See TracChangeset for help on using the changeset viewer.