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: Question about using datasetfun(@(x,y)
Replies: 2   Last Post: Jan 12, 2013 9:18 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
Question about using datasetfun(@(x,y)
Posted: Jan 11, 2013 1:12 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


I had a quick question about using "datasetfun" where the function includes different variables from different columns in a dataset. My dataset is <57617x29> and called SASDoc32. The columns of interest look like:


ans =



ans =


This is only a portion of the dataset. Anyways, all I want to do is append the DocumentSuffix to the DocumentNumber (i.e. for the first entry: '32115466B2510001') in a separate column of the dataset. So I actually have two questions:

1) How to add a new column to a dataset without receiving all these warnings? I have been just assigning values to them and always receive the following warning:

Warning: Observations with default values added to dataset variable 'DocNo'

So is there a proper way to add a column to a dataset? My method works, but warnings are annoying and seem to suggest a better way.

2) My most important question is appending the DocumentSuffix to the DocumentNumber. I have tried using datasetfun in a way cellfun should work. My attempt at this is given by:

SASDoc32(:,'DocNo') = datasetfun(@(x,y) [x,y],'DataVars',{'DocumentNumber','DocumentSuffix'},'DatasetOutput',false);

I always receive the error that I don't have enough input arguments. Does datasetfun not support the @(x,y) command? Any help would be much appreciated. Thanks.

Kevin Ellis

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.