abclinuxu.cz AbcLinuxu.cz itbiz.cz ITBiz.cz HDmag.cz HDmag.cz abcprace.cz AbcPráce.cz
AbcLinuxu hledá autory!
Inzerujte na AbcPráce.cz od 950 Kč
Rozšířené hledání
×
    dnes 01:44 | Pozvánky

    Přemýšlíte, jak začít prázdniny? Už v úterý 1. července se bude konat Virtuální Bastlírna, tedy online setkání bastlířů, techniků, vědců i akademiků, kde se ve volné diskuzi probírají novinky ze světa techniky, ale i jiných zajímavých témat.

    Za poslední měsíc jsme byli svědky plamenů několika raket. Zatímco malá raketa od Hondy se úspěšně vznesla a opět přistála, raketa od SpaceX se rozhodla letět všemi směry najednou. Díkybohu méně … více »
    Uprdkávač | Komentářů: 0
    včera 23:44 | Komunita

    Linus Torvalds zmínil, že souborový systém Bcachefs zřejmě odstraní z mainline Linuxu v začleňovacím okně pro vydání 6.17. Kent Overstreet mu totiž posílá kód s novou funkcionalitou i pro začlenění do kandidátů na vydání, kdy očekává pouze opravy chyb. Ken Overstreet byl již dříve z vývoje vyloučen kvůli konfliktní komunikaci.

    Fluttershy, yay! | Komentářů: 1
    27.6. 11:55 | IT novinky

    Ministerstvo průmyslu a obchodu propaguje Microsoft. Ten ve spolupráci s Ministerstvem průmyslu a obchodu spouští AI National Skilling Plan v ČR. "Iniciativa Microsoftu přináší konkrétní a praktickou podporu právě tam, kde ji nejvíc potřebujeme – do škol, firem i veřejné správy.", říká ministr průmyslu a obchodu Lukáš Vlček.

    Ladislav Hagara | Komentářů: 25
    27.6. 10:55 | Zajímavý projekt

    Jste český ISP? Vyplněním krátkého dotazníku můžete pomoci nasměrovat vývoj nové generace routerů Turris Omnia [𝕏].

    Ladislav Hagara | Komentářů: 4
    27.6. 01:33 | IT novinky

    Celkové tržby společnosti Canonical za rok 2024 byly 292 milionů dolarů (pdf). Za rok 2023 to bylo 251 milionů dolarů.

    Ladislav Hagara | Komentářů: 1
    27.6. 01:22 | Nová verze

    Byla vydána verze 1.88.0 programovacího jazyka Rust (Wikipedie). Podrobnosti v poznámkách k vydání. Vyzkoušet Rust lze například na stránce Rust by Example.

    Ladislav Hagara | Komentářů: 0
    27.6. 01:11 | Nová verze

    Distribuce Tails specializující se ochranu online soukromí uživatele byla vydána ve verzi 6.17. Mimo jiné aktualizuje Tor Browser (14.5.4) a opravuje několik chyb.

    Fluttershy, yay! | Komentářů: 0
    26.6. 21:11 | Nová verze Ladislav Hagara | Komentářů: 0
    26.6. 13:11 | IT novinky

    Město Lyon posiluje svou digitální suverenitu a postupně nahrazuje software od společnosti Microsoft bezplatnými alternativami, zejména OnlyOffice pro kancelářské aplikace a Linux a PostgreSQL pro systémy a databáze.

    Ladislav Hagara | Komentářů: 9
    26.6. 11:44 | Zajímavý projekt

    Evropská občanská iniciativa Stop Destroying Videogames se snaží o to, aby vydavatelé, kteří spotřebitelům v Evropské unii prodávají videohry nebo na ně udělují licence, měli povinnost tyto hry ponechat ve funkčním (hratelném) stavu i po ukončení podpory ze své strany. Podpořit podpisem tuto iniciativu můžete v Systému pro online sběr podpisů.

    trekker.dk | Komentářů: 5
    Jaký je váš oblíbený skriptovací jazyk?
     (59%)
     (28%)
     (7%)
     (2%)
     (0%)
     (1%)
     (3%)
    Celkem 331 hlasů
     Komentářů: 16, poslední 8.6. 21:05
    Rozcestník

    vim a matlab

    14.5.2006 22:48 | Přečteno: 1663× | takruzne | poslední úprava: 16.6.2006 17:27

    keywords vim matlab script m-file

    Nevím, jak jsou na tom verze matlabu nyní, ale tento skript edit.m nahrazuje matlabí edit. Používal jsem jej pro gnome-terminal, ale pak jsem přešel na aterm. Proto je kód pro gnome-terminál ponechán zakomentovaný. Překvapil mne kamarád, že jej používá a bez problémů. Psal jsem to před 2 lety kvůli diplomce, protože jsem prostě na vim zvyklý.

    Logika argumentů je divoká, ale nějak mě to zatím nezradilo.

    Skript je k použítí v xkách. Matlab je dobré spouštet v terminálu jako matlab -nosplash -nojvm -nodesktop

    Soubor nakopírujte do ~/matlab. Použijte help edit
    function [C, A ] = vim( varargin ) 
    
    %           EDIT  
    %           EDIT arg1 arg2 
    %           EDIT ./arg1 ./arg2
    %           EDIT /.../arg1 /.../arg2 
    % [C, A ] = EDIT
    % [C, A ] = EDIT( 'arg1', 'arg2', ... )
    % [C, A ] = EDIT( '-c \"<editor command>\"', 'arg1', 'arg2' )  
    %
    % EDIT overrides a default matlab script EDIT.m.
    % EDIT opens the file in a text editor.  
    %
    % By default, The EDIT editor is used. The user may 
    % specify a different editor by modifying the shell command 
    % in the M-file.
    %
    % EDIT X Y Z ... will atempt to open all specified files in an
    % editor. Each argument is directly passed into an editor argument.
    % Instead of the first file you can use the editor (EDIT) command 
    % as well. But this command has to be the first argument 
    % in the string. 
    %         
    % EDIT '-c \"w\"' FILE1.M FILE2.M 
    %  
    % passes the command "save FILE1.M" to EDIT. Be aware of placing
    % a gap between both the editor command and the file name.  
    %
    %
    % EDIT, by itself, opens up a new editor window.
    %
    %
    % EDIT returns two strings:
    %  	C is the command passed into the terminal input.
    % 	A is the command passed into the editor input. 
    %Copyleft 2004 elviin
    
    
    if ~iscellstr( varargin )
       error( 'The input must be a string.' );
       return;
    end
    
    
    
    cellFileArg = '#'; %Use this character instead of a white space. 
    		   %There are problems with leading and trailing spaces. 
                       
                       %Because in gnome-terminal is needed full file-path.
                       %Say vim to open it. (I don't know why it doesn't work.)
    %gnome-terminal
    %vimOpenFile = '-c#\"e#';
    %aterm
    vimOpenFile = '-c#"e#';
    
    	          %Set the proper directory for edited file.		
    curDir = strcat( pwd, '/' ); 
    
    %gnome-terminal	          %Set the proper directory for editor;		
    %changeDirOptionTail = strcat( curDir, '\"' );
    %aterm
    changeDirOptionTail = strcat( curDir, '"' );
    
    %for gnome-terminal
    %changeDirOption = strcat( '#-c#\"cd#', changeDirOptionTail );
    
    %for aterm
    changeDirOption = strcat( '#-c#"cd#', changeDirOptionTail );
    
    		  %Fill the buffer with arguments.
    for i = 1:nargin
      cVarargin = char( varargin(i) );
      switch cVarargin(1)
        case {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
          Err = sprintf('Remove heading ''%s'' from the name.', cVarargin(1));, ...
          disp(Err)
          return
        case '-', ...
          cellFileArg = strcat( cellFileArg, cVarargin );, ...
          cellFileArg = strcat( cellFileArg, '#' );
        case {'~', '/', '.', '\'}, ...
          if length(cVarargin) < 2
            disp('File name is too short.')
            return
          end
          nameLength = length( cVarargin );
          if strfind( cVarargin( nameLength-1: nameLength ), '.m' )
            cVarargin = strcat( vimOpenFile, cVarargin );
            %for gnome-terminal
            %cVarargin = strcat( cVarargin, '\"' ); %terminate the command
            %for aterm
            cVarargin = strcat( cVarargin, '"' ); %terminate the command
            cellFileArg = strcat( cellFileArg, cVarargin );, ...
            cellFileArg = strcat( cellFileArg, '#' );
          else
            cVarargin = strcat( cVarargin, '.m' );, ...
            cVarargin = strcat( vimOpenFile, cVarargin );, ...
            %for gnome-terminal
            %cVarargin = strcat( cVarargin, '\"'); %terminate the command
            %for aterm
            cVarargin = strcat( cVarargin, '"'); %terminate the command
            cellFileArg = strcat( cellFileArg, cVarargin );, ...
            cellFileArg = strcat( cellFileArg, '#' );
          end
        otherwise     %No exact file name is specified. 
                      %Try to select a file:
          parPath = which( cVarargin ); 
          if ( strcmp( parPath, '' ) )
            nameLength = length(cVarargin);
                      %If the file name is long enough...
            if ( nameLength > 1 )
                      %If .m extension is missing...
              if ( strfind( cVarargin( nameLength-1: nameLength ), '.m' ) )
                cVarargin  = strcat( curDir, cVarargin );
                cellFileArg = strcat( cellFileArg, cVarargin );
                cellFileArg = strcat( cellFileArg, '#' );       
              else  
                cVarargin = strcat( cVarargin, '.m' );
                cVarargin  = strcat( curDir, cVarargin );
                cellFileArg = strcat( cellFileArg, cVarargin );
                cellFileArg = strcat( cellFileArg, '#' );       
              end
            else      %Edit the file in spite of too short name.
              cVarargin = strcat( cVarargin, '.m' );
              cVarargin  = strcat( curDir, cVarargin );
              cellFileArg = strcat( cellFileArg, cVarargin );
              cellFileArg = strcat( cellFileArg, '#' );
              Err = sprintf('File name ''%s''is possibly too short to specify m-file.', cVarargin);, ...
              disp(Err);
            end
          else        %We have found a path to reach the file.
            cellFileArg  = strcat( cellFileArg, parPath );
            cellFileArg = strcat( cellFileArg, '#' );
          end
      end
    end;
    
    
    		  %Convert values of the type cell to the string.  
    cFileArg = char( cellFileArg );
    		  
    		  %Include arguments in to the shell command.
    		  %You can edit both the name of a file manager and an editor. 
    		  %Change editting directory:	
    cFileArg = strcat( changeDirOption, cFileArg );
                      %--zoom arg is useless in Gnome 
    commandGnomeTerminal = strcat( 'gnome-terminal --window-with-profile=matlab --zoom=1.333333333 --geometry=80x25  --command "vim' , cFileArg );
    
    commandATerm = strcat( 'aterm -T Matlab -e vim', cFileArg );
    command = commandATerm; %commandGnomeTerminal
    % command = strcat( command, '"' ); %commandGnomeTerminal terminator
    		  
    
                      %The way how to disable gtk warning messages:
                      %** (gnome-terminal:2240): WARNING **: [Invalid UTF-8]
                      %in case your default xwindow manager is not Gnome.
    execommand = strcat( command, '#');
    execommand = strcat( execommand, '>#/dev/null#2>&1#&');
    execommand = strcat( 'nohup#', execommand );
    
    		  %Replace the character '#' with ' ' and execute the command.
    execommand = strrep( execommand, '#', ' ' );
    
    
                      %Execute the command attached to vim editor: 
    unix( execommand );
    
    
    
    nout = max(nargout,1)-1;
                      %Disable  output messages (0).
                      %List the enabled ones (1, 2). 
    switch nout
    	case 2,
    		C = execommand;,
    		A = strrep( cFileArg, '#', ' ' );
    	case 1,
    		C = execommand;
    		A = strrep( cFileArg, '#', ' ' );
    	case 0,   %(*) explicit obstruction from stdout
    			
    	otherwise
    		disp('To many output arguments.')	
    end;
    	
    
    
    
    
           

    Hodnocení: 100 %

            špatnédobré        

    Tiskni Sdílej: Linkuj Jaggni to Vybrali.sme.sk Google Del.icio.us Facebook

    Komentáře

    Vložit další komentář

    ISSN 1214-1267   www.czech-server.cz
    © 1999-2015 Nitemedia s. r. o. Všechna práva vyhrazena.