help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Extracting a part of a string


From: Ben Abbott
Subject: Re: Extracting a part of a string
Date: Mon, 25 Jun 2012 21:05:26 -0400

On Jun 25, 2012, at 8:52 PM, hersala wrote:

> Dear users,
> 
> Please, how can I extract a part (date) of a string like this:
> 
> EAA-F54-20091023.bin
> 
> Or if exist an analogous to this command taken from GrADS software?
> subwrd (string, n)  # Gets a single word from a string. The result is the nth 
> word of string.
> 
> Thank you very much.
> 
> HernĂ¡n

Does this inline function do what you're looking for?

        subwrd = @(str,n) strsplit (str, "-."){n};
        subwrd ("EAA-F54-20091023.bin", 3)
        ans = 20091023

Ben



reply via email to

[Prev in Thread] Current Thread [Next in Thread]