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 datasetfun
Replies: 1   Last Post: Dec 30, 2012 10:38 PM

Advanced Search

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

Posts: 53
Registered: 11/29/10
Help using datasetfun
Posted: Dec 30, 2012 6:03 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello,

I have a large dataset (411,000 entries with 34 variables). My question involves using datasetfun to convert string variables into numbers. A portion of my dataset looks like this:

SAS.DocumentType(1:15)

ans =

'27'
'49'
'28'
'13'
'32'
'78'
'15'
'27'
'35'
'27'

All I want to do is convert these strings into numbers using str2num and datasetfun. I have tried many combinations of the following code to accomplish this:

SAS.DocumentType = datasetfun(@str2num,SAS.DocumentType);

I also seem to receive the following error message:

Undefined function 'datasetfun' for input arguments of type 'function_handle'.

I think I understand why I am receiving this error. The only way for str2num to work is if I pass it something in the {} brackets. For example, str2num(SAS.DocumentType{1}) works perfectly, but I want to do this for all 400,000 entries without using a FOR-loop. Could someone help me understand how to use datasetfun to accomplish this? Thanks.

Kevin



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.