f



'Matlab Code' to 'Embedded Matlab fun code'

Dear friends,

          I have a Matlab code to process a pure analog signal 'u'. Now I want to implement it in Simulink and I want to use it in 'Embedded Matlab fun block' so i need to transform 'Matlab code' to 'Embedded Matlab fun code' to perform the task. 

          The Matlab code is as follows:

%%%%%%%%%%%%%%%%%%%%%

u_abs = abs(u);
major_th = 1.5e-1;
minor_th = 1.8e-2;

major_peak_value = [];
minor_peak_value = [];
pos = 1;
pos_max = 1;



while ~isempty(pos)
       
    [m pos_max(end+1)] = max( u_abs( pos : pos + 10) );
    pos_max(end) = pos_max(end) + pos - 1;
    
    if m > major_th 
        major_peak_value(end+1) = m;
    else
        minor_peak_value(end+1) = m;
    end
    
    % exit the peak
    pos = find(u_abs(pos:end) < minor_th, 1 , 'first') + pos-1;
    % Find the beginning of the next peak
pos = find(u_abs(pos:end) > minor_th, 1 , 'first') + pos-1;
end

pos_max(2) = [];
plot(u); hold on;
plot(pos_max,u(pos_max),'ro');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 

I think i don't need this plot command as I will see the result in the scope directly.

Any suggestion will be very useful.

Thanking you!

Prashant
0
11/22/2011 11:04:08 AM
comp.soft-sys.matlab 211266 articles. 22 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
1874 Views

Similar Articles

[PageSpeed] 5

"Prashant Sandhi" wrote in message <jafvj8$soq$1@newscl01ah.mathworks.com>...
> Dear friends,
> 
>           I have a Matlab code to process a pure analog signal 'u'. Now I want to implement it in Simulink and I want to use it in 'Embedded Matlab fun block' so i need to transform 'Matlab code' to 'Embedded Matlab fun code' to perform the task. 
> 
>           The Matlab code is as follows:
> 
> %%%%%%%%%%%%%%%%%%%%%
> 
> u_abs = abs(u);
> major_th = 1.5e-1;
> minor_th = 1.8e-2;
> 
> major_peak_value = [];
> minor_peak_value = [];
> pos = 1;
> pos_max = 1;
> 

> 
> 
> while ~isempty(pos)
>        
>     [m pos_max(end+1)] = max( u_abs( pos : pos + 10) );
>     pos_max(end) = pos_max(end) + pos - 1;
>     
>     if m > major_th 
>         major_peak_value(end+1) = m;
>     else
>         minor_peak_value(end+1) = m;
>     end
>     
>     % exit the peak
>     pos = find(u_abs(pos:end) < minor_th, 1 , 'first') + pos-1;
>     % Find the beginning of the next peak
> pos = find(u_abs(pos:end) > minor_th, 1 , 'first') + pos-1;
> end
> 
> pos_max(2) = [];
> plot(u); hold on;
> plot(pos_max,u(pos_max),'ro');
> 
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
> 
> I think i don't need this plot command as I will see the result in the scope directly.
> 
> Any suggestion will be very useful.
> 
> Thanking you!
> 
> Prashant

Any one?
 
 Prashant
0
11/23/2011 9:58:08 AM
Reply:

Similar Artilces:

'''''''''''''The Running Update/Append Queries Using VBA code Ordeal''''''''''''''
Hello fellow programmers, I am trying to run an append/update query from code, a command button on a form initiates the queries. the format i am using is; _____________________________________________________ SELECT "criteria" FROM "criteria" WHERE "criteria" UPDATE/APPEND "field selections" RecordSource "qryExample" = above text strings" _______________________________________________________________________ When i am running a SELECT query in this manner it works fine with no problems, and accepts the values of specified linked form fields. This never works when doing an APPEND/UPDATE query. It can never find the values of linked form fields, Access always asks for the parameter value of the field(s) in question, or Access comes up with an error 3323 - No recordset. I am sure there are other people that have had this problem. What is the difference between Select queries and append/update queries? the append/update queries never seem to be able to find values in linked form fields. Can anyone shed any light on this or point to a knowledgebase Item, or even recommend a book focusing on this subject, I will go and buy it now. I have been for up 2 nights trying to acomplish this and now considering suicide, please help. Thanks In advance, Aaron. I know of two ways you can accomplish this. 1. You can create the SQL script for you append or update query and run the script with DoCmd.RunSQL. 2. You can create a...

'^=' and '~='?
Hello, What is the difference between '^=' and '~='? Thanks, Duckhye ...

New Daily Quiz... OK, Not Really... I am looking for an optimized not-'in-place' 'quick select' algorthm/matlab script/c code
Hello All, The 'quick select' algorithm finds the kth smallest element in the array wi= thout doing a sort first (https://en.wikipedia.org/wiki/Quickselect ). With= proper selection of the k value(s) it is one of the fastest algorithms to = find the median. I have spent considerable time trying to find a not-'in-place' 'quick selec= t' algorithm. I have written my own version in MATLAB, but I am certain the= re is an implementation 'out there' that is more optimized than what I have= done (hopefully in C). I found a reference to the not-'in-place' version being significantly faste= r than the 'in-place' version, which makes sense because it eliminates a lo= t of data swapping within the array at a cost of additional memory that is = 1X or 2X the size of the input array. Since I want to apply it to a fairly = short array, having one or two additional arrays of the same length is not = significant in terms of memory. Does anyone know where to find an optimized not-'in-place' version of 'quic= k select'? Thanks, Dirk Bell ...

calling '!' or 'system' in matlab different than same functions from shell
Hi everyone, When I am in the shell (tcsh) on my Mac (outside Matlab), I am able to use the command line utility ncdump to read netcdf format files (http://www.unidata.ucar.edu/software/netcdf/): ncdump -h testfile.nc However, in Matlab, the same command preceded by the '!' (or using 'system') generates an error: >> !ncdump -h test.nc dyld: Library not loaded: /opt/local/lib/libnetcdf.7.dylib Referenced from: /opt/local/bin/ncdump Reason: Incompatible library version: ncdump requires version 10.0.0 or later, but libnetcdf.7.dylib provides version 9.0.0 Trace/BPT trap ncdump -h test.nc: Trace/breakpoint trap I'm unable to figure out why the command preceded by '!' in Matlab does not invoke the same libraries as the command in the shell. Following a previous listserve thread, I've changed the matlab startup path so it should search through the same directories as the shell, but that doesn't help. I'm running Matlab R2012a (7.14.0.739) on Mac OS 10.7.3. Thanks for any suggestions, Andrew ...

error: expected '=', ',', ';', 'asm' or '__attrib
Hi I'm trying to compile an ADC Driver & come acrosss the following error. I've no experience writing drivers before, and hence have no clue how to fix it. Hope someone out there has encountered the problem & suggesst a fix for the same. The Error is I get is : qadc.c: At top level: qadc.c:97: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'qadc_read' make: *** [qadc.o] Error 1 [root@localhost qadc]# ########################################################################### ADC Driver Code ########################################################################### #define MODULE #define __KERNEL__ #include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> /* printk */ #include <linux/fs.h> / #include <linux/errno.h> /* error codes */ #include <linux/types.h> /* size_t */ #include <linux/proc_fs.h> /* proc file system */ #include <linux/fcntl.h> #include <asm/system.h> /* cli, flags */ #include <asm/uaccess.h> /* copy from/to user */ /*Registers to get qadc access*/ volatile unsigned short * qadcmcr = (unsigned short *)0x40190000; volatile unsigned short * qacr0 = (unsigned short *)0x4019000a; volatile unsigned short * qacr1 = (unsigned short *)0x4019000c; volatile unsigned short * qacr2 = (unsigned short *)0x4019000e; volatile unsigned short * qasr0 = (unsigned short *)0x40190010; volatile unsigned short * qasr1...

'[OFF]' as in 'offensive'???
Hi, given that 'off-topicness' is indicated as '[OT]' and taking a look at those postings that started the threads indicated as '[OFF]' (which may both be seen as being somewhat offensive) may lead to the conclusion that '[OFF]' stands for offensiveness. I don't think that this is the intended meaning so what actually *does* '[OFF]' mean? I never came across that abbreviation before (although I have been around on the USENET for quite some time) but maybe it is worth knowing? Josef 'Jupp' Schugt NOTE: mails >100 KiB are ignored -- German edition of comp.lang.ruby FAQ - http://oss.erdfunkstelle.de/ruby/ Aurox Linux - http://qurl.net/7q | http://qurl.net/7r - Firefox Thunderbird - http://qurl.net/7s | http://qurl.net/7t - Liferea Enigmail - http://qurl.net/7u | http://qurl.net/7v - GnuPG [Josef 'Jupp' Schugt <jupp@gmx.de>, 2004-12-10 23.20 CET] > I don't think that this is the intended meaning so what actually *does* > '[OFF]' mean? Off-topic. ...

Re: '^=' and '~='?
Duckhye, According to the doc ( http://xrl.us/befwjx ) they, and one other set of characters, and the mnemonic 'NE' all represent 'NOT EQUAL'. Art ------- On Wed, 11 Feb 2009 16:52:40 -0600, Duck-Hye Yang <dyang@CHAPINHALL.ORG> wrote: >Hello, >What is the difference between '^=' and '~='? > >Thanks, >Duckhye ...

replacement for '{' and '}' ?
I am still playing around with what kind of syntax I would like to mark up my documents. Are there equivalent long substitutes for { and } when they are not used to describe arguments to functions? Something like \begin{group} and \end{group}. In other words, if I could force myself to write, say, \begin{group} \it ... \end{group} instead of {\it ... }, then I believe I could identify from the markup context what is an argument that belongs to a just invoked macro and what is text. {Of course, in this context, \textit{...} would be better.} No more ambiguity whether a in \myfunction{a} is an argument or just text. Is there a way to make latex barf when it sees an ordinary '{' in text, rather than \begin{group}, but not barf when I want it (to denote macro arguments)? Regards, /iaw On Aug 16, 6:01=A0pm, "ivo...@gmail.com" <ivo...@gmail.com> wrote: > Is there a way to make latex barf when it sees an ordinary '{' in > text, rather than \begin{group}, but not barf when I want it (to > denote macro arguments)? What do you mean exactly? I don't understand. Do you have in mind your- to-be-new-syntax or just regular latex? Cheers, Tomek ivowel@gmail.com wrote: > I am still playing around with what kind of syntax I would like to > mark up my documents. > > Are there equivalent long substitutes for { and } when they are not > used to describe arguments to functions? Something like \begin{group} > and \end{gr...

Simulink 'Moving average' equivalent code in Matlab
Dear All, I have written a 'Moving average' code in embedded matlab function block but I am trying to do the same but with a dynamic size of buffer. The Required logic of moving average is: (This is not a code but it is just a logic of matlab code should look like) n (Length of buffer) = round(fs/f0); fs = 1KHz; fo must not be > than fs/10 Then n = round(1000/90) =11 n2 > n but n2 is a power of 2. Array x[n2],y[n2] Clear complete array x. X[0]=1; // unit pulse For (i=0,i < n;i++) y[i]=BufferSum(x[i]); // unit pulse response end What is BufferSum(x)? New_BufferSum = old_BufferSum - old_sample + new_sample. 'Moving average' code in embedded matlab function: function y = fcn(Moving_u) persistent iCnt persistent p persistent sum % persistent buffer_length % Initialize persistent variables if isempty(iCnt) iCnt=1; end if isempty(sum) sum=0; end if isempty(p) p=zeros(1,11); end if iCnt>11 iCnt=1; end sum = sum-p(iCnt)+Moving_u; p(iCnt) = Moving_u; iCnt=iCnt+1; y=sum; Any suggestions!! ...

Like '' & '' & ''
Having this description column in a table "Cookies, peanut butter sandwich, regular" When using this WHERE clause: WHERE (((Food_Data.Description) Like "*Butter*" & "*Peanut*")); I dont get any results, however when using it this way round WHERE (((Food_Data.Description) Like "*Peanut*" & "*Butter*")); I get the row as expected. I assume that the query looks for them in order. Is there a way i can get around this and make the query search for both keywords no matter which order i ype them in. Thanks Dave [posted and mailed] SkunkDave (dave_casserly@totalise.co.uk) writes: > Having this description column in a table > > "Cookies, peanut butter sandwich, regular" > > > When using this WHERE clause: > > WHERE (((Food_Data.Description) Like "*Butter*" & "*Peanut*")); > > I dont get any results, however when using it this way round > > WHERE (((Food_Data.Description) Like "*Peanut*" & "*Butter*")); > > I get the row as expected. > > I assume that the query looks for them in order. The query looks for a string that matches the pattern "*Peanut**Butter*", so obviously it's not going to match "Butter Peanut". As suggested by Harald Albrech this works: WHERE (Food_Data.Description Like "*Butter*" or Food_Data..Description Like "*Peanut...

s=load('C:\Users\Lubna\matlab\2_1.wav', '-ascii')
when im trying to load a .wav file as ascii, im getting following error , can anybody resolve it??????? s=load('C:\Users\Lubna\matlab\2_1.wav', '-ascii') ??? Error using ==> load Unknown text on line number 1 of ASCII file C:\Users\Lubna\matlab\2_1.wav "RIFFX". "ABC " <looma.amir.ali@gmail.com> wrote in message <jn3vqv$edk$1@newscl01ah.mathworks.com>... > when im trying to load a .wav file as ascii, im getting following error , can anybody resolve it??????? > s=load('C:\Users\Lubna\matlab\2_1.wav', '-ascii') > ??? Error using ==> load > Unknown text on line number 1 of ASCII file C:\Users\Lubna\matlab\2_1.wav > "RIFFX". > Did this start out as a sound file that has been saved to ascii format with the extension .wav? If it's a binary file, why are you not using wavread to read it? Barry On Apr 23, 12:26=A0pm, "ABC " <looma.amir....@gmail.com> wrote: > when im trying to load a .wav file as ascii, im getting following error ,= can anybody resolve it??????? > =A0s=3Dload('C:\Users\Lubna\matlab\2_1.wav', '-ascii') > ??? Error using =3D=3D> load > Unknown text on line number 1 of ASCII file C:\Users\Lubna\matlab\2_1.wav > "RIFFX ". ---------------------------------------------------------------------------= ------------------------------------- Why do you want to do that? Why not just read in the numbe...

Return value of 'each', 'current', 'next', 'end'
These array functions: 'each', 'current', 'next', 'end' They return a reference or a value. let's say I want to modify the last value of an array without iterating through all of them. I would do: <? end($array) ; current($array)="new value" ; ?> is that posible?? Thanks. Hermann.Richter@gmail.com wrote: > These array functions: 'each', 'current', 'next', 'end' > > They return a reference or a value. They return values. > let's say I want to modify the last value of an array without iterating > through all of them. > > I would do: > > <? > end($array) ; > current($array)="new value" ; > ?> > > is that posible?? Try end($array); $array[key($array)] = "new value"; Chung Leong wrote: > Hermann.Richter@gmail.com wrote: > > These array functions: 'each', 'current', 'next', 'end' > > > > They return a reference or a value. > > They return values. > > > let's say I want to modify the last value of an array without iterating > > through all of them. > > > > I would do: > > > > <? > > end($array) ; > > current($array)="new value" ; > > ?> > > > > is that posible?? > > Try > > end($array); > $array[key($array)] = "new value"; $array[(sizeof($array...

Sampling in 'Embedded matlab func.'
Hi I have a problem with correcting the samplingtime in the 'embedded matlab func.' block. Is it possible to set the samplingtime in this block likewise the main samplingtime. The main sampling is a fixed-step size=1, but the embedded block samples 12 times as often. Somebody got a solution to my problem?? Martin Hi Martin, is your system continous and you are using a continous solver (e.g. ode45)? Then you see the integration steps of the solver... Other possibilities are e.g. additional calls because of algebraic loop, smaller time steps of the variable step solver to ensure relative tolerance. Titus "Martin Hogsbjerg" <martin@hogsbjerg.dk> wrote in message news:eee9629.-1@webx.raydaftYaTP... > Hi > > I have a problem with correcting the samplingtime in the 'embedded > matlab func.' block. Is it possible to set the samplingtime in this > block likewise the main samplingtime. The main sampling is a > fixed-step size=1, but the embedded block samples 12 times as often. > > Somebody got a solution to my problem?? > > Martin Hi Titus Thanks for the reply.. Our system is discrete, and we are using the fixed step solver. Is it possible to get the embedded matlab func. to execute one time each sample? Martin Titus Edelhofer wrote: > > > Hi Martin, > is your system continous and you are using a continous solver (e.g. > ode45)? > Then you see the integration steps of the solver... > Oth...

'icfb' versus 'seultra'/'sedsm'
The executable for Silicon Ensemble used to be 'seultra' or 'sedsm'. Now there is 'icfb' with a recent version of Cadence I am dealing with. Are the formers embedded within icfb? I cannot get Silicon Ensemble up running alone. Any hint/help? hamidrezah@yahoo.com wrote: > The executable for Silicon Ensemble used to be 'seultra' or 'sedsm'. > Now there is 'icfb' with a recent version of Cadence I am dealing with. > Are the formers embedded within icfb? I cannot get Silicon Ensemble up > running alone. The "icfb" executable does not contain the "seultra" or "sedsm" tool suite. Specifically, the executable "icfb" (custom IC schematic capture, simulation, layout, & physical verification) does not contain "seultra" or "sedsm" (digital place & route). In future releases (e.g., Virtuoso IC61), increasingly A/d floorplanning and custom analog placement, analog synthesis, and device & block custom routing will be added to the "icfb" tool suite ... but in all cases, AFAIK, Silicon Ensemble will not itself ever be "inside" of icfb. It looks like you're missing "seultra" or "sedsm" in your path. Use the "find" command or the GNU locate command to locate the missing executables (or ask your system administrator). Hope that helps, John Gianni -- Nothing I state here is prior reviewed by my employe...

Re: '^=' and '~='? #5
Sorry, I posted under the wrong subject. My friend asked me to post this, she got an error message in processing the XML file. I don't have much experience in working with XML file. Any help is appreciated! On Thu, Feb 12, 2009 at 10:29 AM, Akshaya Nathilvar < akshaya.nathilvar@gmail.com> wrote: > 32 libname erap 'T:\9SOW\AHRQ_E Rap\Data\E-RAP Data\December 2008'; > NOTE: Libref ERAP was successfully assigned as follows: > Engine: V9 > Physical Name: T:\9SOW\AHRQ_E Rap\Data\E-RAP Data\December 2008 > 33 options nodate nonumber formdlim='-'; > 34 /* Program: E-RAP Load XML to SAS with map v2.sas*/ > 35 > /************************************************************************* > 36 Update path and file name below. > 37 > **************************************************************************/ > 38 %let data_path = T:\9SOW\AHRQ_E Rap\Data\E-RAP Data\December > 2008\Raw XML Data; > 39 %let input_file = 035151_12232008.xml; > 40 > **************************************************************************; > 41 > 42 filename xml_lib "&data_path.\&input_file."; > 43 filename SXLEMAP "&data_path.\xml_map_v2.map"; > 44 libname xml_lib xml xmlmap=SXLEMAP access=READONLY; > NOTE: Libref XML_LIB was successfully assigned as follows: > Engine: XML > Physical Name: XML_LIB &g...

Re: '^=' and '~='? #9
On Thu, 12 Feb 2009 08:58:21 -0600, Joe Matise <snoopy369@GMAIL.COM> wrote: >Yeah, <> works in PROC SQL, wasn't sure about elsewhere... thanks for >confirmation! Didn't know about the MAX operator, that's interesting. .... hi, In proc SQL, I do get a note saying that: NOTE: The "<>" operator is interpreted as "not equals". In general, i find that we have different sas expressions, mostly identical one another. Still, there remain definite differences among all of these expressions: (1) data step expressions (2) where statement expressions (3) sql-expressions used in proc sql (4) macro expressions this is a less than ideal situation :-) but this may be an inevitable consequence of sas' being around for a long time. cheers, chang ...

Re: '^=' and '~='? #8
32 libname erap 'T:\9SOW\AHRQ_E Rap\Data\E-RAP Data\December 2008'; NOTE: Libref ERAP was successfully assigned as follows: Engine: V9 Physical Name: T:\9SOW\AHRQ_E Rap\Data\E-RAP Data\December 2008 33 options nodate nonumber formdlim='-'; 34 /* Program: E-RAP Load XML to SAS with map v2.sas*/ 35 /************************************************************************* 36 Update path and file name below. 37 **************************************************************************/ 38 %let data_path = T:\9SOW\AHRQ_E Rap\Data\E-RAP Data\December 2008\Raw XML Data; 39 %let input_file = 035151_12232008.xml; 40 **************************************************************************; 41 42 filename xml_lib "&data_path.\&input_file."; 43 filename SXLEMAP "&data_path.\xml_map_v2.map"; 44 libname xml_lib xml xmlmap=SXLEMAP access=READONLY; NOTE: Libref XML_LIB was successfully assigned as follows: Engine: XML Physical Name: XML_LIB 45 libname erap "&data_path"; NOTE: Libref ERAP was successfully assigned as follows: Engine: V9 Physical Name: T:\9SOW\AHRQ_E Rap\Data\E-RAP Data\December 2008\Raw XML Data 46 * Read XML file into SAS data set; 47 data erap.Sabino; 48 set xml_lib.E_rap_episode_record; 49 run; ERROR: There is an illegal character in the entity name. encountered during XMLInput pa...

'image' and 'imagesc'
Why is it, that 'image' and 'imagesc' change the y - direction of my data? Or an even more important question, how do I prevent them from doing so? This is the command I use: imagesc(x_vec,y_vec,rez_fld); with: x_vec = 3:0.5:7.5 y_vec = 1:-0.5:-1 rez_fld = size(x_vec) x size(y_vec) greetz, kai Kai: <SNIP wants it upside down... > Why is it, that 'image' and 'imagesc' change the y - > direction of my data... because: that's how you typically look at pics - top/left to bottom/right % now, img=load('clown'); imagesc(img.X); axis image; % -or- % axis ij; disp('change y'); pause; axis xy; % -or- % set(gca,'ydir','normal'); % then disp('get it all right...') pause; imagesc(flipud(img.X)); axis image; axis xy; % for more information help axis; us ...

Re: '^=' and '~='? #2
No difference that I know of ... SAS has all sorts of things you can use as operators. LT,< LE,<= ne, ^=, ~=, <> in some contexts at least eq, = <<< these actually DO have a difference or two, particularly as relates to assignment I don't recall where the full list is, but http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000202951.htm#a000290128has the list of them usable in WHERE statements (which, IIRC, is slightly greater than that of normal code, as it allows for SQL syntax in ways the rest of SAS does not). -Joe On Wed, Feb 11, 2009 at 4:52 PM, Duck-Hye Yang <dyang@chapinhall.org> wrote: > Hello, > What is the difference between '^=' and '~='? > > Thanks, > Duckhye > ...

Re: '^=' and '~='? #7
SAS was originally based on PL/1, and having programmed in PL/1,=20 I'm inclined to use the PL/1 symbol for not equals, which is the ^=3D (actually it is not the caret on IBM mainframes, but the not symbol which looks like L on its side). =20 -Mary ----- Original Message -----=20 From: ./ ADD NAME=3DData _null_;=20 To: SAS-L@LISTSERV.UGA.EDU=20 Sent: Thursday, February 12, 2009 9:09 AM Subject: Re: '^=3D' and '~=3D'? Maybe good reason to use mnemonic equivalents. 882 data _null_; 883 a =3D .v MIN .z; 884 b =3D .v MAX .z; 885 ax =3D .v >< .z; 886 bx =3D .v <> .z; NOTE: The "<>" operator is interpreted as "MAX". 887 c =3D .A NE .A; 888 put (_all_)(=3D);; 889 run; a=3DV b=3DZ ax=3DV bx=3DZ c=3D0 ...

Formating numbers: I want '9' to be '009' and '19' to be '019'
How can I do this ? This is the number used in invoice. Thanks. formatInvoiceNo: Format([InvoiceNo],"000000000") Open the report (form?) in design view, and set the Format property of this text box to: 000 -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "swingingming" <ming.mge@gmail.com> wrote in message news:1123566670.327279.83700@f14g2000cwb.googlegroups.com... > How can I do this ? This is the number used in invoice. > Thanks. Thanks. I will stay with your solution. It works fine. Because the invoice number actually consists of other Texts. ...

(patch for Bash) 'vcat', 'vset', 'vfile'
These 3 builtin commands are designed to "dump" and "reload" shell variables to/from file, without going through another layer of interpretation or parsing. In addition to reading/writing simple string for ordinary shell variable, the commands can handle positional parameters and array variables (both index and values). vcat [-0A] [name] > file Writes a shell variable NAME to stdout (inverse of 'vset'). If NAME is missing, then positional parameters are printed. Each value of array elements and positional parameters is terminated by '\0', whereas ordinary shell variable is not \0-terminated unless option -0 is given. By default, only the array values are printed, but option -A will print the array index as well. vset [-0A] [name] < file Assigns a shell variable NAME from stdin (inverse of 'vcat'). If NAME is missing, then positional parameters are set. If input data contains '\0', then it is considered array, and NAME will be converted to array variable. By default, only array values are set, but option -A will set the array index as well. If there is only one string with trailing '\0', then option -0 will set it to regular shell variable. vfile -[rw] [-d dir] [-0A] name... Read (-r) or write (-w) shell variables from/to files of the same name. Internally, it uses 'vcat' and 'vset', so full array content is preserved. vcat [-0A] name > name vset [...

Scilab's 'optim' and 'splin'
I've got this really cool application that makes a smoothed line using splines, then fits it to a source line using a nonlinear weighting. I'm currently using SciLab with it's 'optim' and 'splin' function to do this, but now I need to write some embeddable C++ code. The 'splin' function is obvious -- it generates a spline from a number of inflection points. The 'optim' function as I am using it uses a quasi-Newton method, which is working just fine for me. Before I go and write this stuff up by hand, does anyone have any suggestions on where I can find example code to do this? I'm mostly concerned with the optimization -- I'd like to get my hands on something where some one else has already fallen into the pitfalls. TIA. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html Just a remark : there is a lsq_splin function which try to fit a splin to discrete points (with various weight if needed). May be it can help you at least to find a good starting point for your optimization ? hth Bruno Tim Wescott wrote: > I've got this really cool application that makes a smoothed line using > splines, then fits it to a source line using a nonlinear weighting. Is it important that you u...

using '!' in matlab script
It seems unable to invoke the '.EXE' file in the matlab script node. In my matlab code I use '!' to invoke a .exe file, it can be execute in matlab, but when I copy the same code to labview(matlab script node), it does not work the error messages are &nbsp; &nbsp; &nbsp; &nbsp; LabVIEW:&nbsp; Error occurred while executing script. Error message from server: Warning: Name is nonexistent or not a directory: D:\Wastewater_experiment\programCodes\DymolaFiles.&gt; In c:\matlab6p5\toolbox\matlab\general\path.m at line 116&nbsp; In c:\matlab6p5\toolbox\matlab\general\addpath.m at line 88&lt; c:\matlab6p5\bin\win32\dsu.txt created.&nbsp;... Error message from alist Error opening file "dsin.txt": No such file or directory &nbsp;??? Error using ==&gt; loadUnable to read MAT file temp.mat: not a binary MAT file.Try LOAD -ASCII to read as text. Error in ==&gt; C:\dn\programCodes\initload.mOn line 43&nbsp; ==&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; load temp Error in ==&gt; C:\dn\programCodes\operatingPoint.mOn line 17&nbsp; ==&gt; [x_init, x_name] = initload; % loads initial conditions from txt-file 'dsin.txt'. . in labviewmatlab.vi &nbsp; &nbsp; &nbsp; I am sure I have add all the path. and If I just run the code ! alist -a dsin.txt dsintest.mat in matlab script node. There is no errors but it can not be execute. &nbsp; &nbsp; This alist.exe file is f...

Web resources about - 'Matlab Code' to 'Embedded Matlab fun code' - comp.soft-sys.matlab

Resources last updated: 3/30/2016 3:41:49 PM