Error using daq.Sessio​n/startBac​kground Too many output arguments?

What the heck am I doing wrong here?
fs = 41000;
d = daq.getDevices;
dev = d(2);
s = daq.createSession('directsound');
ch = addAudioInputChannel(s, dev.ID, 1);
s.IsContinuous = true;
lh = addlistener(s,'DataAvailable', @record);
data = startBackground(s);
Returns:
Error using daq.Session/startBackground Too many output arguments

Answers (1)

startForeground takes output arguments; not startBackground.

10 Comments

But I am trying to get live microphone data, and therefore I need to run it in the background, and then I need to take the data stream and feed it into a bandpower method, so I can get the frequencies of the microphone data.
startBackground is for asynchronous data collection. Your program keeps running during the data collection. At some later point you ask for the data, or you program callbacks that activate when data becomes available.
If you want a flow where you say "Start collecting data and just collect data until it is ready and then return it to me" then you should be using foreground instead of background.
Then how do I process a live stream of information? As in, I am getting the data, processing the data I am receiving, and showing the result, while continuing to receive data?
You would follow the procedure I outline in https://www.mathworks.com/matlabcentral/answers/385805-how-do-i-go-about-using-startbackground-to-get-live-microphone-data-and-process-that-data-live#answer_307922 which is in reply to a substantially identical question asked by someone who appears to have the same name as you. Have you considered pooling ideas with your namesake so that the volunteers do not need to deal with the same question twice?
How would I go about getting rid of this question then? I posted this one because I had an error I didn't know anything about. After a period of not getting a good answer, I made a broader question to better encompass what I was trying to accomplish.
"After a period of not getting a good answer,"
It was 2 hours.
This is a site in which the questions are answered by volunteers, and the volunteers have other things going on with their lives. Like answering questions for other people, or doing their jobs, or going to appointments, or doing house chores or cooking.
2 hours is a long time you know...
"2 hours is a long time you know..."
So sorry... the volunteers that regularly fail to come over to do my laundry, clean my house, cook, and massage my pains away, seem to have continued their perfect non-attendance record, so I have inexplicably had to fill in for them today. I will let them know how disappointed you are in them when all zero of them show up tomorrow.
I don't get why you are so hung up about this. I'm being civil here, and you keep coming at me with some snide remark. I'm thankful you've taken the time to help me out, but I don't appreciate the attitude.
Duplication of questions leads to duplication of efforts and actually slows down response as the volunteers have to compare the questions closely to figure out whether there might be small differences that they might be overlooking that might lead to a quite different solution. Duplicate questions also require that the most active volunteers (the few with high access levels) spend time on detecting and cleaning up the duplicates when their attention could be better put answering questions.
The volunteers tend to be understanding of duplicates when the poster has not received any response at all to their question for several days, as it is natural in such cases for the poster to be think that perhaps the question has been lost: in such cases we close the duplicate and tell the poster that it would be fine for the poster to post a reminder in the original.
But when someone posts a duplicate within a small number of hours while there is even an active discussion going on (that one of the participants might quite reasonably just not had time to get back to because of other commitments), then the volunteers often start to feel as if the person posting the duplicate is being pushy and demanding unreasonably fast response. If someone needs two hour response then they should be hiring a consultant on a Premium contract. Industry standard for Full Service contracts is 4 hours, Premium is 2 to 4 hours, and less than 2 hour guaranteed response is Gold or Platinum level support contacts -- the sort of contracts that are very expensive because the service provider literally has to hire 3 full shifts in order to be sure of responding in time. When I was a sysadmin those contacts started at $75000 per year, and as that was some time ago they are probably beyond $135000 per year.
So you have been expecting service beyond the $100k price level, and you have been expecting it from volunteers.
Remember, in order for you to receive a response here, some particular individual needs to respond you. Questions do not get ineffably answered by osmosis off of people answering nearby questions. Some person has to take the time. The churn rate these days is about 250 active questions per day (160 new, the others having progress made on them.) 2 hours before someone has time to get back to a question is not long at all for someone who is dedicated to answering questions, as there is a lot to get through.

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Asked:

on 1 Mar 2018

Commented:

on 2 Mar 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!