Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Help using textscan or sscanf
Replies: 21   Last Post: Jan 23, 2013 4:02 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,112
Registered: 6/7/07
Re: Help using textscan or sscanf
Posted: Jan 17, 2013 2:23 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 1/17/2013 9:18 AM, dpb wrote:
> On 1/16/2013 4:33 PM, dpb wrote:
> ....
>

>> The solution I gave reproduced your values for your sample set...
>
> OBTW, NB "the trick" in the above solution--horzcat() or shorthand of
> [s1 s2] where s1,s2 are character arrays will transparently "eat"
> intervening blanks to create the shorter lengths automagically you're
> working so hard to create..."use the (hidden) force, Luke..." :)
>
> That's what eliminates the need for all the string parsing and just lets
> it pick the last N desired characters--when were blank-filled and
> right-adjusted in strvcat(), then when the concatenation of the
> prepended string occurs, the spurious blanks go away on their own w/ no
> additional effort.

...

And, if you have cell strings, then just use

strcat(c1,strtrim(c2))

where the c1,c2 are the two cell strings to squish together w/o
intervening spaces.

--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.