Changeset 456 for trunk/src/series.m


Ignore:
Timestamp:
Jun 17, 2012, 10:50:20 PM (12 years ago)
Author:
sommeria
Message:

various bugs corrected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r453 r456  
    539539MinIndex=get(handles.MinIndex,'Data');%retrieve the min indices in the table MinIndex
    540540MaxIndex=get(handles.MaxIndex,'Data');%retrieve the max indices in the table MaxIndex
    541 i_sum=sum(sum(i1_series,2),3);
     541i_sum=sum(sum(i1_series,2),3);%sum of i1_series on the last index
    542542MaxIndex_i=max(find(i_sum>0))-1;
    543 MinIndex_i=min(find(i_sum>0))-1;
    544 j_sum=sum(sum(i1_series,1),3);
     543if isequal(i1_series(1),0)
     544    MinIndex_i=0;
     545else
     546    MinIndex_i=min(find(i_sum>0))-1;
     547end
     548j_sum=sum(sum(j1_series,1),3);
    545549MaxIndex_j=max(find(j_sum>0))-1;
    546550MinIndex_j=min(find(j_sum>0))-1;
     
    650654
    651655%% update time table
     656if ~isempty(time)
    652657TimeTable=get(handles.TimeTable,'Data');
    653658if isempty(MinIndex_j)
     659    if MinIndex_i>0
    654660    TimeTable{iview,1}=time(MinIndex_i);
     661    end
    655662    TimeTable{iview,2}=time(first_i);
    656663    TimeTable{iview,3}=time(last_i);
    657664    TimeTable{iview,4}=time(MaxIndex_i);
    658665elseif ~isempty(time)
     666    if MinIndex_i>0
    659667    TimeTable{iview,1}=time(MinIndex_i,MinIndex_j);
     668    end
    660669    TimeTable{iview,2}=time(first_i,first_j);
    661670    TimeTable{iview,3}=time(last_i,last_j);
     
    663672end
    664673set(handles.TimeTable,'Data',TimeTable)
     674end
    665675
    666676%% number of slices
     
    11081118else
    11091119    enable_i(handles,'On')
    1110     enable_j(handles,'On')
     1120    if isempty(j1_series)
     1121         enable_j(handles,'Off')
     1122    else
     1123        enable_j(handles,'On')
     1124    end
    11111125end
    11121126fill_ListPair(handles,i1_series,i2_series,j1_series,j2_series,time)
     
    12591273set(handles.RUN, 'Enable','Off')
    12601274set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])
     1275drawnow
    12611276[h_fun,Series,filexml,errormsg]=prepare_jobs(handles);
    12621277if ~isempty(errormsg)
    12631278    msgbox_uvmat('ERROR',errormsg)
    12641279else
    1265    Series.Specific=h_fun(Series,0);   
     1280  %Series.Specific=h_fun(Series);   
     1281   Series=h_fun(Series); 
    12661282   t=struct2xml(Series);
    12671283    t=set(t,1,'name','Series');
    12681284    save(t,filexml);
    1269     h_fun(Series);
     1285%     h_fun(Series);
    12701286end
    12711287set(handles.RUN, 'Enable','On')
     
    12931309end
    12941310% update the xml file after interactive input with the function
    1295 Series.Specific=h_fun(Series,0);   
     1311Series.Specific=h_fun('input?');   
    12961312t=struct2xml(Series);
    12971313t=set(t,1,'name','Series');
     
    13051321    return
    13061322end
    1307 fctpath=get(handles.ActionPath,'String');
     1323path_fct=get(handles.ActionPath,'String');
    13081324text_matlabscript=[...
    13091325    '#!/bin/bash \n'...
     
    13111327    'matlab -nodisplay -nosplash -nojvm <<END_MATLAB \n'...
    13121328    'cd(''' path_series '''); \n'...
    1313     'addpath(''' fctpath '''); \n'...
     1329    'addpath(''' path_fct '''); \n'...
    13141330    '' Series.Action  '( ''' filename_xml '''); \n'...
    13151331    'exit \n'...
     
    13181334fclose(fid);
    13191335if isunix
    1320     system(['chmod +x ' filename_bat]);
     1336    system(['chmod +x ' filename_bat]);% set the file to executable
     1337    system(['. ' filename_bat]);%execute fct
    13211338end
    13221339set(handles.BATCH, 'Enable','On')
    13231340set(handles.BATCH,'BackgroundColor',[1 0 0])
     1341
    13241342%------------------------------------------------------------------------
    13251343% --- Executes on button press in BIN.
     
    13331351   
    13341352%------------------------------------------------------------------------
    1335 % --- Main lauch command, called by RUN and BATCH
     1353% --- Main launch command, called by RUN and BATCH
    13361354function [h_fun,Series,filexml,errormsg]=prepare_jobs(handles)
    13371355%------------------------------------------------------------------------
     1356filexml='';
    13381357errormsg='';
    13391358%% Read parameters from series
     
    13431362end
    13441363
    1345 %% read root name and field type
     1364%% read index ranges
    13461365first_i=1;
    13471366last_i=1;
     
    14631482    end
    14641483    filexml=fullfile(Series.OutputDir,[Series.InputTable{1,3} '.xml']);% name of the parameter xml file set in this directory
    1465     t=struct2xml(Series);
    1466     t=set(t,1,'name','Series');
    1467     save(t,filexml);
     1484%     t=struct2xml(Series);
     1485%     t=set(t,1,'name','Series');
     1486%     save(t,filexml);
    14681487end
    14691488
     
    15731592    InputText=textscan(fid,'%s',1,'delimiter','\n');
    15741593    fclose(fid)
    1575     set(handles.ActionName,'ToolTipString',InputText{1}{1})
     1594    set(handles.ActionName,'ToolTipString',InputText{1}{1})% put the first line of the selected function as tooltip help
    15761595end
    15771596if ~isequal(path_series,PathName)
     
    16171636                SeriesData.AllowInputSort=1;
    16181637                set(handles.series,'UserData',SeriesData)
    1619             end             
     1638            end                     
     1639        case 'WholeIndexRange'
     1640            if isequal(lower(varargout{ilist+1}),'on')% sort the input table by alphabetical order of the SubDir
     1641                MinIndex=get(handles.MinIndex,'Data');
     1642                MaxIndex=get(handles.MaxIndex,'Data');
     1643                if ~isempty(MinIndex)
     1644                    set(handles.num_first_i,'String',num2str(MinIndex{1}))
     1645                    set(handles.num_last_i,'String',num2str(MaxIndex{1}))
     1646                    set(handles.num_incr_i,'String','1')
     1647                    if size(MinIndex,2)>=2
     1648                        set(handles.num_first_j,'String',num2str(MinIndex{1,2}))
     1649                        set(handles.num_last_j,'String',num2str(MaxIndex{1,2}))
     1650                        set(handles.num_incr_j,'String','1')
     1651                    end
     1652                end
     1653            end           
    16201654        case 'NbSlice'   %hidden by default
    16211655            if isequal(lower(varargout{ilist+1}),'on')
Note: See TracChangeset for help on using the changeset viewer.