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

Hello,

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:

SASDoc32.DocumentNumber(1:5)

ans =

'32115466B2510'
'32119532F2370'
'32116183B2360'
'32112922F2550'
'32115841F2520'

SASDoc32.DocumentSuffix(1:5)

ans =

'001'
'001'
'001'
'001'
'001'

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]

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