f



Is there a way to keep persistent variable values in Matlab (or s-function) workspace?

I have a c-mex s-function that defines a block in my Simulink model. Each time I run my c-mex s-function code (via my .mexw32 file that executes), a set of calculations is performed. I need to run this system numerous, discrete times, with each system-run performing a different set of calculations. I’m hoping to use a Dwork vector variable named Dwork_TestSet[0] to determine which set of calculations to perform (and, at the end of each set of calculations, this vector variable is incremented, so that the next time the system runs, the *next* set of calculations will execute). 

However, my problem is that every time the system stops running, and then is restarted, the Dwork_TestSet[0] variable always gets reset to 0, thus preventing me from using this as a persistent variable between calculation sets. I’ve attempted the following solutions: 

~ eliminate the initialization statement for this variable within mdlStart()
~ eliminate the (alternative) initialization statement for this variable within mdlInitializeConditions() 
~ try to manually reset the variable to its incremented value within the Matlab workspace (this returns an error message: “Error: Unbalanced or unexpected parenthesis or bracket.” – apparently, the Dwork vector isn’t defined outside of the c-mex s-function code)


The result: none of the above attempts work; the Dwork_TestSet[0] variable is always reset to 0 when each new set of calculations is started.

Is it going to be possible for me to allow this Dwork variable in my c-mex s-function to have persistent values between sets of calculations? I appreciate any advice about how to accomplish this.
0
kmj.work (178)
4/9/2012 8:42:12 PM
comp.soft-sys.matlab 211264 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
1190 Views

Similar Articles

[PageSpeed] 54

You Simulink model should be set up to execute one (and only one) set of data.

To run multiple cases you should call the model within a loop from MATLAB.
Each time through the loop you will essentially

start loop
   set up data for this run
   execute model
   store results (if required
end loop

post process the data.

Note that the reason your DWork data gets reset is because it gets initialized each time the simulation is run.
You cannot persist data within Simulink across model runs.

Phil.
0
phil986 (332)
4/11/2012 2:20:18 PM
Reply:

Similar Artilces:

Matlab S-function
I am trying to access element in a matrix. But it gives me an error message "Attempted to access xxx(0); index must be a positive integer or logical." The input to my s-function is a constant block with value of 1 and data type of uint16. Thus, my input is definitely a positive integer. I also tried to use "cast" to make sure my variable "var" is positive integer but it did not work. I have no idea why Simulink returns this error message. My very simple code is below. function setup(block) block.NumInputPorts = 1; block.NumOutputPorts = 1; block.SetPreCompInpPortInfoToDynamic; block.SetPreCompOutPortInfoToDynamic; block.InputPort(1).Dimensions = 1; block.OutputPort(1).Dimensions = 1; block.NumDialogPrms = 0; block.InputPort(1).DatatypeID = 5; % uint16 block.InputPort(1).Complexity = 'Real'; block.InputPort(1).DirectFeedthrough = false; % Override output port properties %block.OutputPort(1).Dimensions = 1; block.OutputPort(1).DatatypeID = 0; % double block.OutputPort(1).Complexity = 'Real'; % Register sample times block.SampleTimes = [-1 0]; % Specify the block simStateCompliance. block.SimStateCompliance = 'DefaultSimState'; % Register for all block methods block.RegBlockMethod('SetInputPortSamplingMode',@SetInpPortFrameData); block.RegBlockMethod('SetInputPortDimensions', @SetInpPortDims); block...

S-function! in Simulink/Matlab
Hello, S-function! in Simulink/Matlab does anyone solve ODE in S-function! in Simulink C++ blocks instead of matlab m-files? thanks ...

Variables do not keep values after leaving function
i set a variable while im in a function, but it does not keep its value when returning to the place the function was called. is this something to do with register_globals being off? is there anyway i can make the variable keep its value when returning to the code where it branched from? TIA (again) function textsearch($the_items_description){ $pos = strpos($the_items_description, $search_for); if ($the_items_description == "") { $does_contain_text = true; } else { if ($pos === false) { $does_contain_text = false; } else { $does_contain_text = true; } } echo ("before leaving <BR>"); echo ("$does_contain_text"); echo ("<br>"); } In article <pan.2004.01.09.23.49.41.29403@hotmail.com>, mattyrobinson69@hotmail.com says... > i set a variable while im in a function, but it does not keep its value > when returning to the place the function was called. is this something to > do with register_globals being off? is there anyway i can make the > variable keep its value when returning to the code where it branched from? > TIA (again) > global $varname; -- ************************************** The Eldritch Dark: Dedicated to Clark Ashton Smith http://www.eldritchdark.com/ its the $does_contain_text variable that i want to keep the val of i fixed it, i just put $does_contain_text = true; at the start of the file. thanks anyway . i real...

MATLAB's SOUND() function in C
Is there a way to implement MATLAB's sound function under C? For those who don't use MATLAB, it's essentially a simplistic, static, mono sound function that converts a series a numbers into a sound at a given sampling rate. nothing fancy. all the Sound APIs begin by discussing all the fancy drivers and buffers and crazy shit i don't really care about. Thanks. In article <1151779016.882805.282580@d56g2000cwd.googlegroups.com>, sluox@yahoo.com wrote: > Is there a way to implement MATLAB's sound function under C? > > For those who don't use MATLAB, it's essentially a simplistic, static, > mono sound function that converts a series a numbers into a sound at a > given sampling rate. nothing fancy. all the Sound APIs begin by > discussing all the fancy drivers and buffers and crazy shit i don't > really care about. > > Thanks. The basic thing to do is: - SndNewChannel - SndDoCommand to send a bufferCommand - SndDisposeChannel If you intend to play the sound asynchronously, be careful to not dispose the sound channel or the buffer you play before the sound has finished playing (install a callback using SndDoCommand, if you want to be informed when that is) For more info, take a look at the function SndSnip_PlaySoundResourceUsingBufferCmds in SoundSnippets.c (<http://developer.apple.com/samplecode/soundsnippets/listing1.html>). Reinder Reinder Ver...

two matlab's give different values
My friend and I are trying to duplicate answers for a homework, and even though we do the same values, we get different answers: s = 0.0016 0.0016 0.0016 0.0025 ret = 0 0.0400 gmp=inv(s)*ret/(ones(1,2)*inv(s)*ret) returns [infinity;-infinity] on this comp and on mine gmp = 1.0e+015 * 4.8867 -4.8867 is there any way to make it so that mine doesn't have this small precision 10^15 is horrible precision if something should be infinity (which it should be). Why is my matlab broken? How can I fix it? "rob bie" <phubaba@yahoo.com> wrote in message <ge7u1h$13c$1@fred.mathworks.com>... > My friend and I are trying to duplicate answers for a homework, and even though we do the same values, we get different answers: > > s = > > 0.0016 0.0016 > 0.0016 0.0025 > > ret = > > 0 > 0.0400 > > gmp=inv(s)*ret/(ones(1,2)*inv(s)*ret) > > returns [infinity;-infinity] on this comp and on mine > > gmp = > > 1.0e+015 * > > 4.8867 > -4.8867 > > is there any way to make it so that mine doesn't have this small precision 10^15 is horrible precision if something should be infinity (which it should be). Why is my matlab broken? How can I fix it? rob bie wrote: > s = > 0.0016 0.0016 > 0.0016 0.0025 > ret = > 0 > 0.0400 > gmp=inv(s)*ret/(ones(1,2)*inv(s)*ret) > re...

Fortran equivalent to Matlab's eig() function
I'm trying to convert some Matlab code into Fortran 77, as Matlab takes days to solve the multiple finite difference systems I need to solve for. All the Matlab code transfers relatively easily into F77, except for the main solution function (which Matlab makes super easy). I'm not sure if there's some ready-made code I can cut and paste into the F77 program, but essentially I'm trying to substitute for the following line: [V,D]=eig(A,B,'qz') Where Does anyone have any suggestions or advice for how I can implement that in F77? Thanks in advance! Dave On Mon, 08 Sep 2008 08:12:26 -0700, Dave wrote: > program, but essentially I'm trying to substitute for the following > line: > > [V,D]=eig(A,B,'qz') > > Where > > Does anyone have any suggestions or advice for how I can implement that > in F77? > Possibly http://www.netlib.org/lapack/double/dhgeqz.f is what you need. > Thanks in advance! > Dave Jörgen Fantastic. That looks exactly like what I need. Thanks! Dave On Sep 8, 11:03 am, J=F6rgen Tegn=E9r <j.teg...@telia.com> wrote: > On Mon, 08 Sep 2008 08:12:26 -0700, Dave wrote: > > program, but essentially I'm trying to substitute for the following > > line: > > > [V,D]=3Deig(A,B,'qz') > > > Where > > > Does anyone have any suggestions or advice for how I can implement that > > in F77? > > Possiblyhttp://www.netlib.o...

What is the best way to import Excel files, with stock data, into Matlab? I’m using Matlab R2010b (64-bit)
What is the best way to import Excel files, with stock data, into Matlab? I’m using Matlab R2010b (64-bit) I’m trying to import historical prices of stock data. Matlab keeps cutting off the header of each column; it gives me only values. I am thinking that this is a data-type-mixing-issue, or whatever it’s called. I have ‘Dates’ in ColumnA, and ‘MSFT’, ‘PWER’, ‘KO’, and ‘SBUX’, in ColumnB-ColumnE. Basically, if I put the Excel file in my Matlab folder and double-click the file, I see the values in a matrix (no dates and no headers), I hit ‘Next’. Then, I see only one option; one radio button is enabled – ‘Create variable matching preview’. The other two options, ‘Create vectors from each column using column names’ and ‘Create vectors from each row using row names’ – both are greyed out. I’ve seen videos, on YouTube and on the Matlab site, where people import excel data and these options are NOT greyed out. No matter what I do, there options are ALWAYS greyed out. The problem is, when I click ‘Finish’ in my ‘Workspace’ I have a variable named ‘data’ all values in a 575x4 matrix, but I have NO DATES and I have NO HEADERS on the columns. All of this seems to go into another variable, called ‘textdata’; all dates and headers ate in textdata. This is VERY inconvenient. I’m trying to analyze some stock data and I have no headers, so I have no idea which stock is which (I can figure it out, but I think Matlab should do this for me). Also, I have no dates corresponding to ...

The value of variable 'xxx' persists across calls to the same function
Does anyone know how to disable this popup message in Editor whenever the mouse cursor rolls over a persistent variable? ...

how to handle multilple return values from a matlab function in java (using JA builder)
Hi, I wanted to know how to handle multilple return values from a matlab function in java using JA builder, thanks, best regards Fahad Fahad, Wrap each return value into a java object and then pass them into any java method should do the trick. Ed. ...

Is there a way to add constraints to Matlab's non-linear least square solver?
Hi there, I am solving a non-linear least squares problem(constrained and bounded) and I hope to use the Matlab's non-linear least squares solver: help lsqnonlin LSQNONLIN solves non-linear least squares problems. But it doesn't allow specifying constraints(equality and inequality), does anybody know a way to get around this? I know there are many tricks in optimization and there are many experts on these boards, please shed some lights on me. Thank you! Hi, as you can see in the LS section of http://plato.asu.edu/guide.html there are various Matlab codes addressing only some of the aspects of your problem. For the most general problem you better use a full NLP solver. You find them in the Constrained Optimization/NLP section and at least two are in Matlab: SOLNP and SQPLab. Others have a Matlab interface such as IPOPT. On Jul 23, 8:01 pm, "Luna Laurent" <luna_laur...@yahoo.com> wrote: > Hi there, > > I am solving a non-linear least squares problem(constrained and bounded) and > I hope to use the Matlab's non-linear least squares solver: > > help lsqnonlin > LSQNONLIN solves non-linear least squares problems. > > But it doesn't allow specifying constraints(equality and inequality), does > anybody know a way to get around this? > > I know there are many tricks in optimization and there are many experts on > these boards, please shed some lights on me. Thank you! ...

Re: calculating function value with varying variable value
Randall, I believe a simple DO-loop will "do" what you want. ;-) DROP I; DO I = 1 TO 99; Gamma = ROUND(I * .01, .01); F = whatever ... OUTPUT; END; While you could dispense with the need for I by making Gamma your loop control variable (DO Gamma = .01 TO .99 BY .01), I think it's much better to only use integers as loop control variables, to avoid possible accumulation and rounding errors. Mike Rhoads Westat RhoadsM1@Westat.com -----Original Message----- From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of Randall Powers Sent: Monday, February 04, 2008 4:15 PM To: SAS-L@LISTSERV.UGA.EDU Cc: Randall Powers Subject: calculating function value with varying variable value Hello All, I'm trying to calculate the value of a function f(n, gamma, q1,q2,q3,q4) separately for all values of gamma from .01,.02,.03...,.99. I'm plugging in constant values for the other variables, so gamma is the only variable which actually varies. Once I have the values for f, I want to graph f vs. gamma, which I imagine a simple proc plot will do the trick. How do I generate my values of f? I know there is notation that can make me step gamma from .01 to .99 by .01, such that I don't have to write 100 gamma= statements and solve for f 100 times, but I'm not sure how to do it. Thanks! ...

Re: calculating function value with varying variable value #2
... a DO loop appears to do the task; something like... DATA plt; q1= __; q2= __; q3= __; q4= __; n=___; DO gamma = .01 to .99 by .01; f = f(n, gamma, q1,q2,q3,q4); * place the function to compute here; OUTPUT; END; RUN; PROC PLOT data=plt; PLOT f * gamma; Run; quit; Robin High University of Oregon -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Randall Powers Sent: Monday, February 04, 2008 1:15 PM To: SAS-L@LISTSERV.UGA.EDU Subject: calculating function value with varying variable value Hello All, I'm trying to calculate the value of a function f(n, gamma, q1,q2,q3,q4) separately for all values of gamma from .01,.02,.03...,.99. I'm plugging in constant values for the other variables, so gamma is the only variable which actually varies. Once I have the values for f, I want to graph f vs. gamma, which I imagine a simple proc plot will do the trick. How do I generate my values of f? I know there is notation that can make me step gamma from .01 to .99 by .01, such that I don't have to write 100 gamma= statements and solve for f 100 times, but I'm not sure how to do it. Thanks! ...

matlab cwt function
when computing a continuous wavelet transform MatLab uses the function cwt. Ifo ne looks at the code then the line where coefficients are computed looks like coefs(ind,:) = -sqrt(a)*wkeep1(diff(wconv1(val_SIG,f)),lenSIG); what I would like to understand is what analytic formula is used for this computation, in part, what the multiplier sqrt(a) mean and why it is here? Thanks. "Maxim" wrote in message <ilsnt8$6b1$1@ginger.mathworks.com>... > when computing a continuous wavelet transform MatLab uses the function cwt. Ifo ne looks at the code then the line where coefficients are computed looks like > coefs(ind,:) = -sqrt(a)*wkeep1(diff(wconv1(val_SIG,f)),lenSIG); > > what I would like to understand is what analytic formula is used for this computation, in part, what the multiplier sqrt(a) mean and why it is here? > Thanks. Hi Maxim, This expression is easily derived from the CWT as the inner product between the signal and the translated and dilated wavelet. Unfortunately, this forum does not lend itself to posting the derivation. Basically, the code comes from making a piecewise-constant approximation to the input signal, then recognizing that the integral of the wavelet over an interval [k,k+1) can be written as the difference of integrals (-\infty, k+1) - (-\infty, k). Casting this as the difference of two convolutions is obtained by a change of variable in the integral which results in the sqrt(a) term and the minus sign out in front. Wa...

problem with matlab function
Hello, I am using a matlab function "vitdec" to simulate viterbi decoding i awgn channel. I noticed a rather weird problem with it. When I increase th msglength the BER improves(eventually plateaus down), my understanding i that BEr improves with the traceback length. Attached is the matlab cod and the BERs I observed, traceback length was fixed to 15 for a constrain length of 3. Is there something wrong i am doing or is there a problem wit vitdec? your help will be greatly appreciated. Thanks ***************************************************************************** msglen: 15, 30, 300, 3000, 30000 BER: 2.1e-3, 8.2e-4, 1.5e-4, 9.5e-5, 8.7e-5 **************************************************************************** Matlab Code clear all snr=4; k=3;%constraint length msglen=30000;%msg length tblen=15;%traceback length for snr_idx=1:length(snr) p=sqrt(0.5)*(10^(-1*snr(snr_idx)/20)); no_bit_errors=0;no_bits=0; while no_bit_errors<100 msg = randint(1,msglen); % Random data t = poly2trellis(k,[7 5]); % Define trellis. [code fstate] = convenc(msg,t,0); % Encode the data. noise=p*randn(1,2*msglen); inp_bit=2*code-1; rec_bit=inp_bit+noise; [hrdout]= vitdec( (rec_bit>0), t, tblen, 'trunc', 'hard' ); no_bit_errors=no_bit_errors+sum(abs(msg-hrdout)); no_bits=no_bits+length(msg); end BER(snr_idx)=no...

Functions of audioplayer matlab
Hey, I have a GUI with 3 buttons, all 3 button play songs when loaded from a file, So im using Audioplayer and its playing Button 1, but when i press button 2, Button 1 is still playing and button 2 also plays and so on with button 3... So my question is, what do I do so when Button 1 is playing and I press Button 2, Button 1 music is stopped and Button 2 music starts playing, same with Button 3. (I dont want to add any other buttons, I want it to stop automatically when I press other button and plays that song). function myplay(file) if isunix, %using system's play (from the sox package) on Unix (MATLAB's sound does not work) [s,w]=unix(['play ' file]); else, %using MATLAB's wavplay on Windows [y,fs]=wavread(file); player=audioplayer(y,fs); play(player); pause(max(size(y))/fs); end "Tom Albert" <husein06@hotmail.com> wrote in message news:jp8i6a$3of$1@newscl01ah.mathworks.com... > Hey, > I have a GUI with 3 buttons, all 3 button play songs when loaded from a > file, So im using Audioplayer and its playing Button 1, but when i press > button 2, Button 1 is still playing and button 2 also plays and so on with > button 3... So my question is, what do I do so when Button 1 is playing > and I press Button 2, Button 1 music is stopped and Button 2 music starts > playing, same with Button 3. (I dont want to add any other buttons, I want > it to stop automatically when I press other button and pla...

Problem with a function in Matlab
Hello everybody! I have a little problem and I hope have an answer here. Sorry for my bad english, I am french and I don't speak English very well. :) I have a very simple function J(x,A,B) which returns y =0.5*x'*A*x-B'*x; When I write in the script: a=[1;2] b=0.5*a'*An*a-Bn'*a; it works without problem and Matlab returns the value of b. (there is no problem with dimensions) but when I call the funtion J: b=J(a,An,Bn) Matlab displays a error: "Undefined function or method 'J' for input arguments of type 'double'." I don't understand where this error comes from. Can anyone help me? :=) On May 18, 5:46=A0am, "Raphael " <raphael.hert...@gmail.com> wrote: > Hello everybody! I have a little problem and I hope have an answer here. = Sorry for my bad english, I am french and I don't speak English very well. = :) > I have a very simple function J(x,A,B) which returns y =3D0.5*x'*A*x-B'*x= ; > > When I write in the script: > a=3D[1;2] > b=3D0.5*a'*An*a-Bn'*a; > it works without problem and Matlab returns the value of b. (there is no = problem with dimensions) > but when I call the funtion J: > b=3DJ(a,An,Bn) > Matlab displays a error: =A0"Undefined function or method 'J' for input a= rguments of type 'double'." > I don't understand where this error comes from. > Can anyone help me? :=3D) Show the code that defines the...

Matlab parallel for loop or Matlab open pool
I am trying to to some computations and I would like to do it in parallel using parfor or by Opening the matlabpool.. as the current implementations is too slow: result=zeros(25,16000); for i = 1:length(vector1) % length is 25 for j = 1:length(vector2) % length is 16000 temp1 = vector1(i); temp2 = vector2(j); t1 = load(matfiles1(temp1).name) %load image1 from matfile1 t2 = load(matfiles2(temp2).name) % load image2 from matfile2 result(i,j)=t1.*t2 end end It work fine but I would really like to know if there is a way to speed thing up ... Thanks a lot in advance! ...

Contribute to MATLAB Central and Win a MATLAB Jacket
Many of you who post to this newsgroup are also regular contributors to the MATLAB Central File Exchange. Look for your favorite contributors on our File Exchange Author Profile page. You can read their profiles and see pictures: <http://www.mathworks.com/matlabcentral/reports/fileexchange/allProfiles/> In a random drawing, we recently awarded MATLAB jackets to three File Exchange authors with profile pages: Michele Giugliano, Andrey Egin, and Denis Gilbert. You can win a jacket, too. Just submit a new file to the File Exchange or update your author profile by December 2003 for a chance to win one of four MATLAB jackets. See the jacket below: <http://www.mathworks.com/matlabcentral/images/jeff3.jpg> Here are some interesting File Exchange facts: - Since its inception in 2001, visitors have downloaded more than 1.25 million submissions from the File Exchange. - In September 2003 alone, visitors downloaded 80,085 files, an average of 2670 a day! .... what if the prize was a free copy of the next version of Matlab :-) majb Min Poh wrote: ....or an offer for employment... aj "bourassa" <bourassa-m@rmc.ca> wrote in message news:3f9d507d$1@rmcnt03a.rmc.ca... > ... what if the prize was a free copy of the next version of Matlab :-) > > majb > > Min Poh wrote: > ...

How can I use a Matlab function, whose inputs varies with time (real time function), in simulink
Hello I need your help I would llike to know how can I use a Matlab function, whose inputs varies with time (real time function), in simulink. Thank you in advance Hiba ...

Simple way to loop a directory's files and put the file's text into string variable
Can someone please give me some code sample on how to do this in VB? So far I tried two methods and I've read of a third one that uses "DIR" but I don't know how to write the "DIR" method. I need to know which code would loop through the files fastest? Or they are all the same? I have SQL files that I want to read one by one and using SQL DMO execute them. Here's one sample I have for looping files... Dim sSQL As String Dim iFile As Integer FileListBoxTest.Path = "C:\Temp" FileListBoxTest.Pattern = "*aa.sql" For i = 0 To FileListBoxTest.ListCount - 1 iFile = FreeFile() Open FileListBoxTest.Path & "\" & FileListBoxTest.List(i) For Input As #iFile sSQL = Input(LOF(iFile), #iFile) Close #iFile If sSQL <> "" Then oDatabase.ExecuteImmediate sSQL, SQLDMOExec_Default Next i The problem is I actually had to create a FileListBox on my VB form in order for this code to work. In my case I don't want to give the user any FileListBox to choose files from. All I want the user to do is press a command button and the code will loop through a hard coded folder, read each file, put each file's contents into a string variable and execute each of them using SQL DMO. Here's the second sample: Dim FSO As Scripting.FileSystemObject Set FSO = CreateObject("Scripting.FileSystemObject") Dim tsTextFile As TextStream If FSO.FileExists("C:\temp\a.sql") T...

Call Matlab m-file from Matlab Scrip Node
My problem with matlab script node is related to calling function in matlab.&nbsp; I created an m-file function that takes an imput temperature (from DAQ) and defines a material property.&nbsp; My matlab script node doesn't seem to recognize my function.&nbsp; I have placed the function in the folder the vi is currently located, but it doesn't read it.&nbsp; How do I get matlab script node to read the functions I create in matlab? Add the directory to matlab path, or call the .m file with it full name ( D:\..... \myfile.m) Let me clarify, &nbsp; I have pasted my matlab code into the matlab scrip node. &nbsp; In this code, I have called a subfunction that I have created. &nbsp; Example k(n)=k_c(T(n)) where k_c is a subfunction I have created. &nbsp; How do I get my code in the node&nbsp;to sucessfully read the subfunction k_c? &nbsp; &nbsp; &nbsp; As indicated, you need to add the directory where the .m file containing the function resides to the list of paths that are read in. This is your startup.m file. The other option is to do a "cd" command prior to calling your function to change to the directory where the .m file containing the function resides. Thanks for reiterating the information.&nbsp; My matlab script node is working properly.&nbsp; I had never used the "cd" command in matlab.&nbsp; I always set the working directory when I open the program, and put all the m files into t...

Variable argument function as a parameter of a variable argument function
Hi everyone, I've done a little searching, but I can't quite find an answer to my question. Everything I've found is more related to how to construct a variable argument function, and that's not my question. Suppose I have a variable argument function. Is it possible to use it to initialize a parameter of another variable argument function? For example, printf("%s", varArgFcnReturningAString(a,b,c)); I ask because I'm not sure if this is supported by the standard and/or could be compiler specific. Thank you for any help, tips, and suggestions! On 11/20/2011 2:02 AM, AikidoGuy wrote: > Hi everyone, > > I've done a little searching, but I can't quite find an answer to my > question. Everything I've found is more related to how to construct a > variable argument function, and that's not my question. > > Suppose I have a variable argument function. Is it possible to use it > to initialize a parameter of another variable argument function? > > For example, printf("%s", varArgFcnReturningAString(a,b,c)); > > I ask because I'm not sure if this is supported by the standard and/or > could be compiler specific. > > Thank you for any help, tips, and suggestions! Not sure what you're unsure about. Before a function call (printf in this case), all arguments are evaluated; think of this as varArgFcnReturningAString(a,b,c) replaced with a pointer value it returned. What is...

Need help for a matlab mini project
Hello everyone, I have a matlab in class exercise due in few days. I am new to matlab and the instructions provided with the assignment is minimal. Can Someone help me with the basic understanding as in how can I map the problem's solution to matlab script ? I am not able to post question here as it is a jpeg file. Please let me know and then we can discuss further. ...

Complexities with how MATLAB reads functions
Hey Guys, essentially how i am writing my function, as MATLAB is plotting something different to what i want. I write my function into wolfram alpha, and obtain the desired result. However when i paste this into MATLAB the period has been drastically reduced. Here is the link for what i have placed into wolfram: http://www.wolframalpha.com/input/?i=y+%3D+5cos%28x%29+-+%285%2F4%29cos%2830%29+-+cos%2830-x%29+%2B%281-4%2B16%2B25%29%2F%288%29 And here is my code: x = 90:180; y = 5*cos(x) - (5/4)*cos(30) - cos(30-x) +(1-4+16+25)/(8); plot(x,y) Can someone please explain why the two methods are reading the same function so differently, this is part of a much bigger problem which i can't move on through until this little error is rectified. Any help would be so greatly appreciated! Thanks In article <k2gtb0$lu6$1@newscl01ah.mathworks.com>, "Jac " <jac_domney@hotmail.com> wrote: > Hey Guys, essentially how i am writing my function, as MATLAB is plotting > something different to what i want. I write my function into wolfram alpha, > and obtain the desired result. However when i paste this into MATLAB the > period has been drastically reduced. > > Here is the link for what i have placed into wolfram: > http://www.wolframalpha.com/input/?i=y+%3D+5cos%28x%29+-+%285%2F4%29cos%2830%2 > 9+-+cos%2830-x%29+%2B%281-4%2B16%2B25%29%2F%288%29 > > And here is my code: > x = 90:180; > y = 5*cos(x) -...

Web resources about - Is there a way to keep persistent variable values in Matlab (or s-function) workspace? - comp.soft-sys.matlab

Persistent - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

HTTP persistent connection - Wikipedia, the free encyclopedia
Under HTTP 1.0 , there is no official specification for how keepalive operates. It was, in essence, tacked on to an existing protocol. If the ...

Autonomous Recharging for Persistent Missions with Quadrotors - YouTube
Implementation of autonomous battery charging routines for persistence missions with teams of quadrotor helicopters. This video showcases the ...

Sydney Swans hound persistent Freo out of final
Until recently, my dog Bruce had a toy rubber chicken. Bruce's idea of playtime was to take the chicken in his teeth and shake it and thrash ...

Serious abuse at Defence Academy 'more widespread and persistent'
Claims of serious abuse at the Australian Defence Force Academy and HMAS Leeuwin naval base are "more widespread and persistent" than previously ...

Advanced volatile threat: New name for old malware technique? - advanced persistent threat, advanced ...
... 'APTs are working just fine,' says Triumfant CEO. But they could one day start a cyberwar, he said There is something worse than advanced persistent ...

Thousands of primary school students across NSW suspended for 'persistent misbehaviour'
THE number of children on long suspension from school has blown out to the highest level in five years.

Whistleblower's NAB leak reveals persistent bad behaviour in financial planning, fuels royal commission ...
It was early August 2014, and the financial advice industry was on red alert. Within National Australia Bank, a sensitive and explosive internal ...

Persistent Scud prevails
Mark Philippoussis is about to enter Wimbledon's main stage having moved into the fourth round with an erratic, brave and, finally, convincing ...

Nobel laureate Desmond Tutu in Cape Town hospital with 'persistent infection'
... Town. Johannesburg: South African archbishop and Nobel laureate Desmond Tutu has been admitted to a hospital in Cape Town to treat a "persistent ...

Resources last updated: 3/30/2016 1:05:57 PM