f



'dataread' and 'textscan' Large Text Files

Hi folks,

I have a working Simulink model in SimEvents which reads data from a text file. Each row includes entitiy attributes which I assign to an entity generated by an Entity Generator block. The porblem I'm experiencing now is the long time it takes to finish reading/extracting all of the rows each clock time. You see, when I did my coding at the beginning, I was working on small files, say 150-ish rows each. Now, I'm dealing with > 40k rows.

Here is a brief on my coding/functions I've implemented:
First, I have an Entity Generator. The number of entites leaving the block is labelled 'd'. I'm using 'd' as an input to an Embedded Matlab Function that reads the number of rows of the text file. Basically, the 'd' works as the index in reading the "current" row. The reason for this function is it computes the 'inter-generation time' for the Entity Generator. It might sound a bit weired, but basically the 'intergeneration time' of entities are computed via an Embedded Matlab Function, and it uses the 'd' as the index. Now, in the Embedded Matlab Function, I have the following code:
______________________________________________
function intergen_time =  fcn(d)
eml.extrinsic('dataread')
rows = 0;
rows = length(dataread('file', 'MyTextFile.txt', '%s', 'delimiter', '\n'));
if d <= rows
    intergen_time = d * 1e-10;
else
    intergen_time = 1e10;
end
______________________________________________
As you can notice, it reads the whole text file every time I create a new entity. This is problemetic. How can I make this more efficient in my scenario here?

Another coding bit I did here is a Level2 MS Function for extracting information from each row and prepare them for entities' arrtibutes. See below, please:
_______________________________________________
function Level2_WF_iii(block)
setup(block);

function setup(block)
% Registering input and ouput ports with their appropriate dimensions etc..
....

% Registering block methods etc..
....

block.SampleTimes = [-1 0];
block.SimStateCompliance = 'DefaultSimState';

block.RegBlockMethod('Outputs', @Outputs);

function Outputs(block)
fclose('all')
fid = fopen('workload_1_new.txt');
if block.InputPort(1).Data < 1 % Input(1) is 'd' - the rows index coming from the Entity Generator
    block.InputPort(1).Data = 1;
end
text_lines = length(dataread('file', 'workload_1_new.txt', '%s', 'delimiter', '\n'));
if block.InputPort(1).Data <= text_lines
    a = textscan(fid, '%f%f%f%f%f%f%f%s', 1, 'delimiter', '\t', 'headerlines', block.InputPort(1).Data-1); % 'emptyvalue', NaN('double')
    block.OutputPort(1).Data = a{1}; % J_ID
    block.OutputPort(2).Data = a{2}; % T_ID
    block.OutputPort(3).Data = a{3}; % NoT
    block.OutputPort(4).Data = a{4}; % Cores
    block.OutputPort(5).Data = a{5}; % T_ET
    block.OutputPort(6).Data = a{6}; % J_ET
    Deps = a{8}; % Raw values with (\) between Deps.
    num_slash = length(findstr(mat2str(cell2mat(Deps)), '/'));
    extract = sscanf(cell2mat(Deps), '%d/')';
    len_num = length(extract);
    len_nan = num_slash - len_num + 1;
    block.OutputPort(7).Data(1:len_num) = extract;
    block.OutputPort(7).Data(len_num+1:len_num+len_nan) = NaN('double');
    block.OutputPort(8).Data = a{5} * 1.2; % Deadline
    block.OutputPort(9).Data = a{7}; % Release Time
    fclose(fid)
    fclose('all')
else
    block.OutputPort(2).Data = NaN('double');
end
_______________________________________________
I'm opening and closing the whole of the text file every time I receive a new 'd' value, i.e. when a new entity is released from the Entity Generator. How can I make this more optimal with respect to time it takes to finish reading, extracting and assigning the right parameter for the right attribute. As I said before, this code works fine for small-scale text files, and the only problem I have with large-scale text-files is the time it takes to finish processing it, other than that, no bugs whatsoever.

Suggestions?
:-)
0
h4ghazzawi (70)
3/13/2013 11:32:05 AM
comp.soft-sys.matlab 211266 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

3 Replies
786 Views

Similar Articles

[PageSpeed] 8

Hi Tiger,

A developer at MathWorks taught me two good ways to incrementally read from 
a file during simulation.

1. Use Simulink's From File block: This block reads incrementally from a MAT 
file during simulation. If you can get your data in MAT file format (MAT 
v7.3), this would be the easiest out-of-the-box approach.

2. Use a MATLAB S-function: If you cannot convert it to a MAT file, then you 
can write your own S-function and use MATLAB APIs like fopen, 
fscanf/textscan and fclose to read the file incrementally as a numeric.

Both of these blocks can be used with SimEvents inside an Atomic Subsystem 
that receives input from an entity generator's #d port as a trigger. (A zero 
delay server will be needed between the source and Set Attribute block.)

It looks like you are reading in the whole file every time. It's best to 
avoid using functions that do this like dataread, textread, strread, etc. 
with a file as large as yours I think.

Anyway, I hope this helps.

-Teresa


"Tiger " <h4ghazzawi@hotmail.co.uk> wrote in message 
news:khpo3l$24b$1@newscl01ah.mathworks.com...
> Hi folks,
>
> I have a working Simulink model in SimEvents which reads data from a text 
> file. Each row includes entitiy attributes which I assign to an entity 
> generated by an Entity Generator block. The porblem I'm experiencing now 
> is the long time it takes to finish reading/extracting all of the rows 
> each clock time. You see, when I did my coding at the beginning, I was 
> working on small files, say 150-ish rows each. Now, I'm dealing with > 40k 
> rows.
>
> Here is a brief on my coding/functions I've implemented:
> First, I have an Entity Generator. The number of entites leaving the block 
> is labelled 'd'. I'm using 'd' as an input to an Embedded Matlab Function 
> that reads the number of rows of the text file. Basically, the 'd' works 
> as the index in reading the "current" row. The reason for this function is 
> it computes the 'inter-generation time' for the Entity Generator. It might 
> sound a bit weired, but basically the 'intergeneration time' of entities 
> are computed via an Embedded Matlab Function, and it uses the 'd' as the 
> index. Now, in the Embedded Matlab Function, I have the following code:
> ______________________________________________
> function intergen_time =  fcn(d)
> eml.extrinsic('dataread')
> rows = 0;
> rows = length(dataread('file', 'MyTextFile.txt', '%s', 'delimiter', 
> '\n'));
> if d <= rows
>    intergen_time = d * 1e-10;
> else
>    intergen_time = 1e10;
> end
> ______________________________________________
> As you can notice, it reads the whole text file every time I create a new 
> entity. This is problemetic. How can I make this more efficient in my 
> scenario here?
>
> Another coding bit I did here is a Level2 MS Function for extracting 
> information from each row and prepare them for entities' arrtibutes. See 
> below, please:
> _______________________________________________
> function Level2_WF_iii(block)
> setup(block);
>
> function setup(block)
> % Registering input and ouput ports with their appropriate dimensions 
> etc..
> ...
>
> % Registering block methods etc..
> ...
>
> block.SampleTimes = [-1 0];
> block.SimStateCompliance = 'DefaultSimState';
>
> block.RegBlockMethod('Outputs', @Outputs);
>
> function Outputs(block)
> fclose('all')
> fid = fopen('workload_1_new.txt');
> if block.InputPort(1).Data < 1 % Input(1) is 'd' - the rows index coming 
> from the Entity Generator
>    block.InputPort(1).Data = 1;
> end
> text_lines = length(dataread('file', 'workload_1_new.txt', '%s', 
> 'delimiter', '\n'));
> if block.InputPort(1).Data <= text_lines
>    a = textscan(fid, '%f%f%f%f%f%f%f%s', 1, 'delimiter', '\t', 
> 'headerlines', block.InputPort(1).Data-1); % 'emptyvalue', NaN('double')
>    block.OutputPort(1).Data = a{1}; % J_ID
>    block.OutputPort(2).Data = a{2}; % T_ID
>    block.OutputPort(3).Data = a{3}; % NoT
>    block.OutputPort(4).Data = a{4}; % Cores
>    block.OutputPort(5).Data = a{5}; % T_ET
>    block.OutputPort(6).Data = a{6}; % J_ET
>    Deps = a{8}; % Raw values with (\) between Deps.
>    num_slash = length(findstr(mat2str(cell2mat(Deps)), '/'));
>    extract = sscanf(cell2mat(Deps), '%d/')';
>    len_num = length(extract);
>    len_nan = num_slash - len_num + 1;
>    block.OutputPort(7).Data(1:len_num) = extract;
>    block.OutputPort(7).Data(len_num+1:len_num+len_nan) = NaN('double');
>    block.OutputPort(8).Data = a{5} * 1.2; % Deadline
>    block.OutputPort(9).Data = a{7}; % Release Time
>    fclose(fid)
>    fclose('all')
> else
>    block.OutputPort(2).Data = NaN('double');
> end
> _______________________________________________
> I'm opening and closing the whole of the text file every time I receive a 
> new 'd' value, i.e. when a new entity is released from the Entity 
> Generator. How can I make this more optimal with respect to time it takes 
> to finish reading, extracting and assigning the right parameter for the 
> right attribute. As I said before, this code works fine for small-scale 
> text files, and the only problem I have with large-scale text-files is the 
> time it takes to finish processing it, other than that, no bugs 
> whatsoever.
>
> Suggestions?
> :-)
> 
0
thubsche (3)
3/13/2013 3:44:19 PM
Hi Teresa,

I like the From File block solution you proposed, thanks for your response. I realise that .mat files have a certain structure and the notion of time stamps is necessary. This concerns me in the structure of data in my text files.

The strucure of my text files is the following:
1	1	107	20	0.62658	176.83104	0.0	-1/-1/-1/-1/-1
1	2	107	5	0.80615	176.83104	0.0	1/-1/-1/-1/-1
1	3	107	10	2.44456	176.83104	0.0	1/-1/-1/-1/-1
1	4	107	20	1.12288	176.83104	0.0	1/-1/-1/-1/-1
1	5	107	5	2.01829	176.83104	0.0	1/-1/-1/-1/-1
1	6	107	1	1.45781	176.83104	0.0	1/-1/-1/-1/-1
1	7	107	20	1.33053	176.83104	0.0	1/-1/-1/-1/-1
1	8	107	1	0.72314	176.83104	0.0	1/-1/-1/-1/-1
1	9	107	1	1.16513	176.83104	0.0	2/-1/-1/-1/-1
1	10	107	1	2.42055	176.83104	0.0	3/-1/-1/-1/-1

As you can notice, my data here is rows-oriented i.e. each row forms the attributes for each generated entity. Whereas in the .mat structure, data there is columns-oriented, right? So, if I want to take the .mat approach, how do you suggest I tackle this issue of data formatting? Do you reckon it's a matter of transposing? If so, can you, please, elaborate? Besides, do you think my last element (the one with forward slashes) of each row might be problematic when converting to .mat files?

Thanks a lot.
0
h4ghazzawi (70)
3/15/2013 5:33:09 PM
On 3/15/2013 12:33 PM, Tiger wrote:
....

> The strucure of my text files is the following:
> 1 1 107 20 0.62658 176.83104 0.0 -1/-1/-1/-1/-1
> 1 2 107 5 0.80615 176.83104 0.0 1/-1/-1/-1/-1
....
> 1 10 107 1 2.42055 176.83104 0.0 3/-1/-1/-1/-1
>
> As you can notice, my data here is rows-oriented i.e. each row forms the
> attributes for each generated entity. Whereas in the .mat structure,
> data there is columns-oriented, right? So, if I want to take the .mat
> approach, how do you suggest I tackle this issue of data formatting? Do
> you reckon it's a matter of transposing? If so, can you, please,
> elaborate? Besides, do you think my last element (the one with forward
> slashes) of each row might be problematic when converting to .mat files?

Matlab internal storage is always column-major; mat files are written 
however the user instructs--by default that will be column-major, of 
course, but it the file was written using a transpose operation then the 
file storage order is row-major order.  So, "it depends"--all you can be 
certain of is the internal storage--you or your app have to know the 
storage order of external files (from whatever source).

Text files generally are sequential as yours--it's just part of why one 
generally creates a text file is to make them human-readable and most 
often they're created sequentially, besides.

You will definitely have to parse the column containing the '/' to store 
the data in anything in Matlab other than a cell array where the last 
column would have to be character data.  The easiest thing to do would 
be to import w/ textscan() (or textread() if want a "regular" 2D array 
instead of cell array) w/ the addition of it as a white-space character 
using the 'whitespace' optional parameter as

'whitespace',' \b\t/'

This will end up giving you those values as additional columns, of 
course, but you can then treat them numerically instead of as a 
character string.

And, if you then save the data to a .mat file, save it as it is in 
memory and recall it the same way transparently.  You don't really care 
what it looks like internally to the file.  For text files, otoh, to 
write them so will be as expected if open in an external text viewer or 
editor, then you do want to use the transpose on the write like, say,

fprintf(fid,[repmat('%d ',1,size(x,2)) '\n'],x');

to write an array "x".

--

0
none1568 (7453)
3/15/2013 5:50:01 PM
Reply:

Similar Artilces:

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

'''''''''''''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 for...

'''''''''''''The Running Update/Append Queries Using VBA code Ordeal'''''''''''''' #2
Hi, Thanks for ur help there HJ. I know how to do the tasks you specified there. I would like for the update query to use field values from some of the fields on the form (frmInvoices) such as InvoiceNumber, DateFrom, DateTo. My problem is that an append/update query can't find the values in the open Form (frmInvoices) when I specify them as; [Forms]![frmInvoices]![InvoiceNumber] a select query has no problem finding the field values on a form. please help. Aaron Hi Aaron, Could you post the entire code that you are having trouble with? Now it is not possible to see what goes wrong. HJ "Aaron" <aaron@rapid-motion.co.uk> wrote in message news:260d7f40.0408120245.2f3d01f8@posting.google.com... > Hi, > > Thanks for ur help there HJ. > > I know how to do the tasks you specified there. > > I would like for the update query to use field values from some of the > fields on the form (frmInvoices) such as InvoiceNumber, DateFrom, > DateTo. My problem is that an append/update query can't find the > values in the open Form (frmInvoices) when I specify them as; > > [Forms]![frmInvoices]![InvoiceNumber] > > a select query has no problem finding the field values on a form. > > please help. > > Aaron First off, if you are not always using all the parameters specified in your form, then you have to add parameters to your query on the fly. Also, you can't just do something like qdf.SQL = "SE...

if str_mo not in ('','.') and str_da not in ('','.') and str_yy not in ('','.') Any shorter ?
Hi, there. =20 I'm just curious if it ever dawned on anybody how to abbreviate this line : if str_mo not in ('','.') and str_da not in ('','.') and str_yy not in ('','.')=20 =20 Igor Kurbeko Clinical Programmer Analyst 678 336 4328 ikurbeko@atherogenics.com =20 no brain no pain =20 how about: if not (str_mo in ('','.') or str_da in ('','.') or str_yy in ('','.')) OR if not (missing(str_mo) or missing(str_da) or missing(str_yy)) Eric On 22 Oct 03 21:13:37 GMT, ikurbeko@ATHER...

A function with 'and' , 'not' , 'null' , 'car' and 'cdr'
What's this ? (defun enigma (x) (and (not (null x)) (or (null (car x)) (enigma (cdr x))))) "I suppose I should learn Lisp, but it seems so foreign." - Paul Graham, Nov 1983 On Wed, Oct 07 2015, CAI GENGYANG wrote: > What's this ? > > > (defun enigma (x) > (and (not (null x)) > (or (null (car x)) > (enigma (cdr x))))) Bad taste? It returns T if the list X contains nil as an element. It would be clearer to write (some #'null x). Helmut CAI GENGYANG ...

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 ##...

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...

Override 'and' and 'or'
Is it possible to override 'and' and/or 'or'? I cannot find a special method for it... __and__ and __rand__ and __or__ and __ror__ are for binary manipulation... any proposals? Have marvelous sunday, Marco Dekker <m.aschwanden@gmail.com> wrote: > Is it possible to override 'and' and/or 'or'? I cannot find a special > method for it... __and__ and __rand__ and __or__ and __ror__ are for > binary manipulation... any proposals? If you want to customize the truth value testing you have to implement __nonzero__ " __nonzero__( self) Call...

Replacing ',' with '.'
Hello, I have a huge amount of numbers in a .txt file. The numbers are in the form 2,43252e+1. I need to replace the , with . How should I do this? I'd prefer some import method that does this during the import procedure. -Janne Hi, I guess you import the data as text and convert it then to numbers. Try 'strrep' before you convert the text to numbers. Tobias Jake the Snake schrieb: > Hello, > > I have a huge amount of numbers in a .txt file. The numbers are in the form 2,43252e+1. I need to replace the , with . How should I do this? I'd prefer some import method...

logical to 'on' / 'off'
Hi, is there a function implemented doing this conversion? my Problem is, that I want to use the following code: set(handles.edit_curr_trq_sl,'Enable',get(hObject,'Value')) where get(hObject,'Value') gives the state of a checkbox thank you! function [str]=tf2oo(logic) switch logic case 0 str='off'; case 1 str='on'; end%switch end%function tf2oo() while i do not know a built in function, I use my own:) meisterbartsch wrote: > > > function [str]=tf2oo(logic) > switch logic > case 0 > str='off'; &g...

Does '!=' equivelent to 'is not'
I'm a bit confusing about whether "is not" equivelent to "!=" if a != b: ... if a is not b: ... What's the difference between "is not" and "!=" or they are the same thing? pirata wrote: > I'm a bit confusing about whether "is not" equivelent to "!=" > > if a != b: > ... > > if a is not b: > ... > > > What's the difference between "is not" and "!=" or they are the same thing? No, they are not the same thing. == and != test to see if the *value* of two variables are the same. Like so: >>> a = 'hello world' >>> b = 'hello world' >>> a == b True a and b both have the value of 'hello world', so they are equal is and is not, however, do not test for value equivalence, they test for object identity. In other words, they test to see if the object the two variables reference are the same object in memory, like so: >>> a is b False a and b are assigned to two different objects that happen to have the same value, but nevertheless there are two separate 'hello world' objects in memory, and therefore you cannot say that a *is* b Now look at this: >>> c = d = 'hello world' >>> c == d True >>> c is d True In this case, they are again the same value, but now the is test also shows that they are the same *object* as well, because...

Diff between '{..}' and {'..'}
Hi, Could anyone tell me the difference between ......| awk '{.......}' AND ......| awk {'......'} And also when(in what situation) these are used? Thanks in advance, Anil. 2005-01-12, 22:37(-08), Anil: > Hi, > > Could anyone tell me the difference between > > .....| awk '{.......}' > > AND > > .....| awk {'......'} > > > And also when(in what situation) these are used? > Thanks in advance, [...] The second one should never be used. The difference is at the shell level, not at the awk level. '...' are stro...

Difference between 'is' and '=='
Hey guys, this maybe a stupid question, but I can't seem to find the result anywhere online. When is the right time to use 'is' and when should we use '=='? Thanks alot~ mwql: >Hey guys, this maybe a stupid question, but I can't seem to find the >result anywhere online. When is the right time to use 'is' and when >should we use '=='? http://docs.python.org/ref/comparisons.html -- Ren´┐Ż Pijlman mwql wrote: > Hey guys, this maybe a stupid question, but I can't seem to find the > result anywhere online. When is the right time to ...

'!' vs. '.'
Is there an advantage to using the '!' notation to represent form/ control relationships? (eg. Me!text1 vs Me.text1) I am currently using the '.' notation exclusively (for code completion in the VB Editor), but much of the high-quality code that I've seen (in Duane Hookom's Query-by-Form db, for example) uses the other. Here's one opinion for you: http://doc.advisor.com/doc/05352 robert.waters wrote: >Is there an advantage to using the '!' notation to represent form/ >control relationships? (eg. Me!text1 vs Me.text1) > >I am currently using the '.' notation exclusively (for code completion >in the VB Editor), but much of the high-quality code that I've seen >(in Duane Hookom's Query-by-Form db, for example) uses the other. -- HTH - RuralGuy (RG for short) acXP WinXP Pro Please post back to this forum so all may benefit. Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200704/1 Here's my $0.02 worth on this. I tend to copy the notation style and naming conventions that I see being used in the Help files. That would be Me![text1] for a control on a form. I am of the belief that this notation explicitly refers to a control itself rather than a field in the form's recordset. Here's an example: I have a parts inventory app that uses a "Line" code, which is usually a 3-character abbreviation for a brand name, and is the na...

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} i...

difference between ',' and 'a,'
Small question. In gforth is there a difference between the words ',' and 'a,'? I'm thinking not, so perhaps another question, why have both ',' and 'a,'? Thanks Should be the same, in gforth: see , : , here cell allot ! ; ok see a, : , here cell allot ! ; ok On Friday, January 9, 2015 at 5:46:04 AM UTC-8, beeflo wrote: > Small question. In gforth is there a difference between the words ',' and 'a,'? > > I'm thinking not, so perhaps another question, why have both ',' and 'a,'...

Meaning of ':' and '{}'
Hi, Please, can anyone tell me what is meaning of predicates ':' and '{}' ? ---------------- yours Advait Advait wrote: > Hi, > Please, can anyone tell me what is meaning of predicates ':' and '{}' > ? It depends on the context. : is used for module qualification of predicates. Like lists:member(X,L) The curly brackets are used in Definite Clauses Grammars: find the section on DCGs in the manual or google for it and you will find out easily. There are uses of {} as a functor in datastructures also. Cheers Bart Demoen Hello everyone,...

'a'..'z'
Is it possible to achieve something like this? switch (mystring.charAt(0)) { case 'a'..'z': // do something break; } "cruster" <cruster@gmail.com> wrote in message news:1151319731.988814.326200@m73g2000cwd.googlegroups.com... > Is it possible to achieve something like this? > > switch (mystring.charAt(0)) { > case 'a'..'z': > // do something > break; > } > There are times when an if statement may be more appropriate ;) Sorry - java is not VB :) -- LTP :) cruster schreef: > Is it possible to achieve somethi...

'[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 ...

We Are Selling The Nextel I930 For Just $130usd'''''''''''
Dear Customer We have all brands of Mobile Phones,Ipods,Sidekicks,Nextel phone,Laptops for sell at cheap an affordable prices, they ranges from Nokia/Samsung/LG/Son Ericsson/Motorola/Alcatel/panasonic With Bluetooth, al Brands and Models of Nextel Phones, we want you to get bac to us with your quote so that we can begin a good busines relationship. Note they are all Brand New T2 Euro specs unlocked, no operator logo, come in thei original sealed box, With 1 year international warrant from the manufacturer, English & Spanish manual, Finlan made We want to assure you that you will never r...

Re: if str_mo not in ('','.') and str_da not in ('','.') and str_yy not in ('','.') Any shorter ? #2
Igor, There are many ways to make it more concise, however the parsimony is likely to be achieved at the expense of clarity. For instance, the expressions length ( input (mm||dd||yy, $10.) ) > 2 length ( compress(mm||dd||yy, ' .') ) > 2 and like might be somewhat shorter than the original, but they will execute slower, and their intent is far less eminent. Since it appears that you are trying to validate the components of a date, maybe it is not a worthless idea to try the date informat conforming to the mask you are testing. Say if all the pieces are 2-digit, the expression input (mm||dd||yy, ?? mmddyy6.) will return a missing value for the case you are testing and also if any irregularities in the input value that prevent it from being interpreted as a valid date should be found. And if you want a note in the log to alert you about it, leave one of the question marks off. Kind regards, ================= Paul M. Dorfman Jacksonville, FL ================= >From: Igor Kurbeko <ikurbeko@ATHEROGENICS.COM> >Reply-To: Igor Kurbeko <ikurbeko@ATHEROGENICS.COM> >To: SAS-L@LISTSERV.UGA.EDU >Subject: if str_mo not in ('','.') and str_da not in ('','.') and str_yy > not in ('','.') Any shorter ? >Date: Wed, 22 Oct 2003 17:13:37 -0400 > >Hi, there. > > > >I'm just curious if it ever dawned on anybody how to abbreviate this >line : > >if ...

remove from a txt everything between '[' and '] ' (included '[' and '] ')
from: [FOOooOoOOO] this is ok1 [FOOooOOO] this is ok2 to: this is ok1 this is ok2 tnx! :) On Apr 3, 8:00 pm, slystoner <slysto...@gmail.com> wrote: > from: > [FOOooOoOOO] this is ok1 > [FOOooOOO] this is ok2 > > to: > this is ok1 > this is ok2 > > tnx! :) echo '[FOOooOoOOO]' | sed 's/\[[^]]\+\]//' Jeenu ha scritto: > On Apr 3, 8:00 pm, slystoner <slysto...@gmail.com> wrote: >> from: >> [FOOooOoOOO] this is ok1 >> [FOOooOOO] this is ok2 >> >> to: >> this is ok1 >> this is ok2 >> >...

web('file', 'filename' '-browser') not working
Hello, I'm working on a project involving Matlab and a nice flashy GUI. To call help files, I do: web('file', 'help.html' '-browser'); On my computer, this works. After compiling it, it works. If I manage to get the current directory wrong, somehow, the browser attempts to go to www.help.com, rather than put up an error. So far so good, except when the file isn't there, which I'm ignoring for the moment. However, when I run the program on other computers (I compile the program first), it always goes to www.help.com, no matter what the pwd says, or where I put help.html. This seems to happen on about half of the other computers I try it on. Any ideas? I had thought it was just path mixups but putting 'pwd' in the appropriate places seems to indicate nothing is amiss. I do not want to use explicit path names, (ie 'file:///c:/stuff/help.html' syntax) as this program is meant for some distribution and I can't guarantee that people will always have it running from the same location. Thank you in advance, --Anne I finally did a = sprintf('file:///%shelp.html#%s', pwd, section); web('file', a, '-browser'); I discovered that the file:/// syntax does not require paths to be deliminated by '/' but can use '\' unlike what I had thought. I read a bug report that using the internal web browser crashes when using compiled code. However, a similar crash happens for me when using R2006a....

Web resources about - 'dataread' and 'textscan' Large Text Files - comp.soft-sys.matlab

Resources last updated: 3/10/2016 7:42:54 AM