The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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: 62
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


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:


ans =


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.


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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.