Changeset 778


Ignore:
Timestamp:
May 23, 2014, 7:36:25 PM (10 years ago)
Author:
sommeria
Message:

movie export fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r773 r778  
    636636% --- Executes on button press in InputFileREFRESH.
    637637function InputFileREFRESH_Callback(hObject, eventdata, handles)
    638 %------------------------------------------------------------------------   
     638%------------------------------------------------------------------------
    639639set(handles.InputFileREFRESH,'BackgroundColor',[1 1 0])% set button color to yellow to indicate that refresh is under action
    640640set(handles.uvmat,'Pointer','watch') % set the mouse pointer to 'watch'
     
    642642% read the current input file name:
    643643[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    644 % if ~exist(fullfile(RootPath,SubDir),'dir')
    645 %     msgbox_uvmat('ERROR',['directory ' fullfile(RootPath,SubDir) ' does not exist'])
    646 %     return
    647 % end
    648644% detect the file type, get the movie object if relevant, and look for the corresponding file series:
    649645[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
    650 % initiate the input file series and inputfilerefresh the current field view:
    651 errormsg=update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileInfo,MovieObject,1);
    652 % inputfilerefresh the second series if selected
    653 if get(handles.SubField,'Value')
     646if isempty(i1_series)
     647    fileinput=uigetfile_uvmat('pick an input file',fullfile(RootPath,SubDir));
     648    hh=dir(fileinput);
     649    if numel(hh)>1
     650        msgbox_uvmat('ERROR','invalid input, probably a broken link');
     651    else
     652        %% display the selected field and related information
     653        if isempty(fileinput)
     654            errormsg='aborted';
     655        else
     656            display_file_name(handles,fileinput,1)
     657        end
     658    end
     659else
     660    % initiate the input file series and refresh the current field view:
     661    errormsg=update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileInfo,MovieObject,1);
     662end
     663
     664%% refresh the second series if relevant
     665if ~isempty(errormsg) && get(handles.SubField,'Value')
    654666    [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles);
    655     if ~exist(fullfile(RootPath,SubDir),'dir')
    656         msgbox_uvmat('ERROR',['directory ' fullfile(RootPath,SubDir) ' does not exist'])
    657         return
    658     end
    659667    % detect the file type, get the movie object if relevant, and look for the corresponding file series:
    660668    [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
    661     % initiate the input file series and inputfilerefresh the current field view:
    662     errormsg=update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileInfo,MovieObject,2);
    663 end
    664 
    665 if isempty(errormsg)
    666 % set(handles.InputFileREFRESH,'BackgroundColor',[1 0 0])% set button color to red to indicate that refresh has been updated
    667 else
    668     set(handles.InputFileREFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull
     669    if isempty(i1_series)
     670        fileinput=uigetfile_uvmat('pick an input file for the second line',fullfile(RootPath,SubDir));
     671        hh=dir(fileinput);
     672        if numel(hh)>1
     673            msgbox_uvmat('ERROR','invalid input, probably a broken link');
     674        else
     675            %% display the selected field and related information
     676            if isempty(fileinput)
     677                errormsg='aborted';
     678            else
     679                display_file_name(handles,fileinput,2)
     680            end
     681        end
     682    else
     683        % initiate the input file series and inputfilerefresh the current field view:
     684        errormsg=update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileInfo,MovieObject,2);
     685    end
     686end
     687if ~isempty(errormsg)
     688    set(handles.InputFileREFRESH,'BackgroundColor',[1 0 1])% put back button color to magenta, input not succesfull
    669689end
    670690set(handles.uvmat,'Pointer','arrow')% set back the mouse pointer to arrow
     
    46964716set(handles.MenuExportMovie,'BusyAction','queue')% activate the button
    46974717huvmat=get(handles.InputFileREFRESH,'parent');
    4698 UvData=get(huvmat,'UserData');
     4718% UvData=get(huvmat,'UserData');
    46994719%[xx,xx,FileBase]=read_file_boxes(handles);
    47004720[RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);
     
    47384758msgbox_uvmat('INPUT_Y-N',{['adjust figure ' num2str(newfig) ' with its matlab edit menu '] ;...
    47394759        ['then press OK to get the avi movie as a copy of figure ' num2str(newfig) ' display']});
    4740 UvData.plotaxes=newaxes;% the axis in the new figure becomes the current main plotting axes
    4741 set(huvmat,'UserData',UvData);
     4760% UvData.plotaxes=newaxes;% the axis in the new figure becomes the current main plotting axes
     4761% set(huvmat,'UserData',UvData);
    47424762increment=str2num(get(handles.num_IndexIncrement,'String')); %get the field increment d
    47434763set(handles.STOP,'Visible','on')
     
    47564776set(htitle,'String',['t=' time_str])
    47574777set(handles.speed,'Value',1)
     4778AxesPos=get(newaxes,'Position');
     4779handles.PlotAxes=newaxes;% the axis in the new figure becomes the current main plotting axes
    47584780for i=1:imax
    47594781    if get(handles.speed,'Value')~=0 && isequal(get(handles.MenuExportMovie,'BusyAction'),'queue') % enable STOP command
    47604782            runpm(hObject,eventdata,handles,increment)% run plus
     4783            set(newaxes,'Position',AxesPos)
    47614784            drawnow
    47624785            time_str=get(handles.TimeValue,'String');
     
    47694792end
    47704793aviobj=close(aviobj);
    4771 UvData=rmfield(UvData,'plotaxes');
    4772 set(huvmat,'UserData',UvData);
     4794% UvData=rmfield(UvData,'plotaxes');
     4795% set(huvmat,'UserData',UvData);
    47734796msgbox_uvmat('CONFIRMATION',{['movie ' aviname ' created '];['with ' num2str(imax) ' frames']})
    47744797
Note: See TracChangeset for help on using the changeset viewer.