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í
×
    včera 17:55 | Nová verze

    Ubuntu pro testování nových verzí vydává měsíční snapshoty. Dnes vyšel 1. snapshot Ubuntu 26.04 LTS (Resolute Raccoon).

    Ladislav Hagara | Komentářů: 0
    včera 14:33 | IT novinky

    Zástupci členských států EU se včera shodli na návrhu, který má bojovat proti šíření materiálů na internetu zobrazujících sexuální zneužívání dětí. Nařízení známé pod zkratkou CSAM a přezdívané chat control mělo množství kritiků a dlouho nebyla pro jeho schválení dostatečná podpora. Pro schválení byla potřeba kvalifikovaná většina a dánské předsednictví v Radě EU se snažilo dosáhnout kompromisu. Návrh nakonec po dlouhých týdnech

    … více »
    Ladislav Hagara | Komentářů: 8
    včera 12:22 | Zajímavý software

    Britské herní studio Facepunch stojící za počítačovými hrami Garry's Mod a Rust uvolnilo svůj herní engine s&box (Wikipedie) jako open source. Zdrojové kódy jsou k dispozici na GitHubu pod licencí MIT. Herní engine s&box je postavený nad proprietárním herním enginem Source 2 od společnosti Valve.

    Ladislav Hagara | Komentářů: 1
    včera 04:55 | Komunita

    Vývoj programovacího jazyka Zig byl přesunut z GitHubu na Codeberg. Sponzoring na Every.

    Ladislav Hagara | Komentářů: 3
    včera 04:44 | Komunita

    Stejně jako GNOME i KDE Plasma končí s X11. KDE Plasma 6.8 poběží už pouze nad Waylandem. Aplikace pro X11 budou využívat XWayland.

    Ladislav Hagara | Komentářů: 2
    26.11. 14:55 | IT novinky

    Poslanci Evropského parlamentu dnes vyzvali k výraznému zvýšení ochrany nezletilých na internetu, včetně zákazu vstupu na sociální sítě pro osoby mladší 16 let. Legislativně nezávazná zpráva, kterou dnes odsouhlasil Evropský parlament poměrem 493 hlasů pro ku 92 proti, kromě zavedení věkové hranice 16 let pro využívání sociálních sítí, platforem pro sdílení videí či společníků s umělou inteligencí (AI) vyzývá také k zákazu … více »

    Ladislav Hagara | Komentářů: 46
    26.11. 14:11 | Humor

    Doom v KiCadu nebo na osciloskopu? Žádný problém: KiDoom: Running DOOM on PCB Traces a ScopeDoom: DOOM on an Oscilloscope via Sound Card.

    Ladislav Hagara | Komentářů: 3
    26.11. 12:44 | Nová verze

    Po AlmaLinuxu byl v nové stabilní verzi 10.1 vydán také Rocky Linux. Přehled novinek v poznámkách k vydání.

    Ladislav Hagara | Komentářů: 0
    26.11. 04:00 | Zajímavý software

    Open source reimplementace počítačových her Tomb Raider I a Tomb Raider II spolu s dalšími vylepšeními a opravami chyb TRX byla vydána ve verzi 1.0. Jedná se o sloučení projektů / enginů TR1X a TR2X do jednoho TRX. Videoukázka na YouTube.

    Ladislav Hagara | Komentářů: 1
    25.11. 17:00 | IT novinky

    Společnost Seznam.cz spouští konverzační nástroj založený na umělé inteligenci Seznam Asistent. Asistent využívá vlastní jazykový model SeLLMa a dočasně i komerční modely od OpenAI provozované v evropských datacentrech prostřednictvím Microsoft Azure. Dlouhodobým cílem Seznamu je provozovat Asistenta výhradně na interních jazykových modelech a ve vlastních datových centrech.

    Ladislav Hagara | Komentářů: 8
    Jaké řešení používáte k vývoji / práci?
     (34%)
     (46%)
     (20%)
     (18%)
     (23%)
     (16%)
     (24%)
     (16%)
     (18%)
    Celkem 413 hlasů
     Komentářů: 17, poslední 19.11. 21:57
    Rozcestník

    vim a matlab

    14.5.2006 22:48 | Přečteno: 1689× | 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.