while loop inside a for loopHi, can someone please tell me why "time" (t) is not updated correctly within the while loop? Please run this small code in your machine and you'll know what I'm taking about.
What I want is: for t=1 run the "while loop" until iq<=(numberc-1) then t=2 run the "while loop" again until iq<=(numberc-1), and so on.
Basically, this code runs through all the nonzero elements of A and attempts to divide them individually into two, once a certain time has passed. Please feel free to ask for clarifications.
Many thanks in advance.
A=[0 0 0 0 0 0 ...
Triple nested loop python (While loop insde of for loop inside of while loop)try to make my triple nested loop working. My code would be:
c = 4
y1 = []
m1 = []
std1 = []
while c <24:
c = c + 1
a = []
f.seek(0,0)
for columns in ( raw.strip().split() for raw in f ):
a.append(columns[c])
x = np.array(a, float)
not_nan = np.logical_not(np.isnan(x))
indices = np.arange(len(x))
interp = interp1d(indices[not_nan], x[not_nan], kind = 'nearest')
p = interp(indices)
N = len(p)
dt = 900.0 #Time step (seconds)
fs = 1./dt #Sampling frequency
KA,PSD = oned_Fourierspectrum(p,dt) # Call Song's 1D FS function
time_axis = np.linspace(0.0,N,num = N,endpoint = False)*15/(60*24)
plot_freq = 24*3600.*KA #Convert to cycles per day
plot_period = 1.0/plot_freq # convert to days/cycle
fpsd = plot_freq*PSD
d = -1
while d <335:
d = d + 1
y = fpsd[d]
y1 = y1 + [y]
m = np.mean(y1)
m1 = m1 + [m]
print m1
--------------------------------------------------------------------------------
My purpose is make a list of [mean(fpsd[0]), mean(fpsd[1]), mean(fpsd[2]).. mean(fpsd[335])]. Each y1 would be the list of fpsd[d].
I check it is working pretty well before second while l...
Re: i am having a problem with while loops, i have two while loops, i have a random number generator inside the "inside" loop and i want to read an array outside the "outer" I think I have a similar problem - I have a while loop with Flat Sequence controlled for loop that produces output. This output needs to be displayed every while loop pass, but I get no output as the while loop feeds back thru a shift register and repeats all the innner funcions without sending the ouput to form new entries in the array.
Is there any way we could stop the while loop for a split second (but practically just for no time, so that no time is wasted when it outputs the data)?
Or is it a bad approach altogether?
Appreciate any advice.
kolo...
timed loop inside a while loopHi all,
I want to ask if I have a timed loop inside a while loop , the timed loop does a certain task a 100 iteration ( each time loop iteration is 2 second duration) each while loop iteration , at each while loop iteration the time loop writes the actual time spent to a text file for this certain task.
for the next while loop, the timed loop contiues to write the time spent from the previous while loop ( ex the first while loop the time loop ends the last results with 200 second for a 100 time ...
looping inside string containing * / avoid shell expansionhello,
i'm new to linux shell, i would like to split a string like this one:
TEST="apath/ anotherpath/*.txt"
for d in $TEST
do
echo "$d"
done
here i wanted to output:
>apath
>anotherpath/*.txt
btw i just can not avoid shell to expand '*.txt' to 'file1.txt',
'file2.txt'; etc.
i think i am missing something around 'TEST' in 'for d in $TEST' but i
have no clues...
best,
On Sat, 08 May 2004 09:39:49 -0700, Valia wrote:
> hello,
>
> i'm new to linux shell, i would like to split a string like this one:
&...
Any way to access an outside UNIX shell from inside firewall?Sorry if this is off-topic. I have some free UNIX shell accounts at
e.g. rootshell.be, cyberspace.org. But our company firewall only
allows outbound access through HTTP and FTP ports (maybe plus a few
others). I can't telnet or ssh to them.
http://m-net.arbornet.org/login/ offers a Web-based Java applet for
shell access. But that doesn't work either probably because the applet
simply does a telnet. Is there a way to access those UNIX shells?
Thanks.
Yong Huang
On Wed, 03 Mar 2004 16:17:50 -0800, Yong Huang wrote:
> Sorry if this is off-topic. I have some free UNIX shell accounts ...
Putting the loop inside of loop properlyI just would like to make my previous question simpler and I bit adjusted m=
y code with help with Ulich and Chris.
The basic structure of my code is:
for c in range(5,25):
for columns in ( raw.strip().split() for raw in f ):
a.append(columns[c])
x =3D np.array(a, float)
not_nan =3D np.logical_not(np.isnan(x))
indices =3D np.arange(len(x))
interp =3D interp1d(indices[not_nan], x[not_nan], kind =3D 'nearest=
')
p =3D interp(indices)
N =3D len(p)
fpsd =3D plot_freq*PSD
f.seek(0,0)
for d in range(336):
y =3D fpsd[d]
y1 =3D y1 + [y]
m =3D np.mean(y1)
m1 =3D m1 + [m]
------------------------------------------------------------------
I just removed seemingly unnecesary lines. I expect that last loop can prod=
uce the each order values (first, second,.... last(336th)) of fpsd from for=
mer loop.
fpsd would be 20 lists. So, fpsd[0] in third loop shoul be first values fro=
m 20 lists and it expects to be accumulated to y1. So, y1 should be the lis=
t of first values from 20 fpsd lists. and m is mean of y1. I expect to repe=
at 356 times and accumulated to m1. However, it doesn't work and fpsd value=
s in and out of the last loop are totally different.
My question is clear?
Any help or questions would be really appreciated.
Isaac
On 2013-03-01 18:07, Isaac Won wrote:
&g...
speed up for loop inside for loop short questionHi there,
Given three column vectors x,y,z I want to calculate the probabilities:
P(X<Y<Z), P(X=Y<Z), P(X<Y=Z), P(X=Y=Z).
The following code gets the job done but I would like it to be faster. Is there a way of getting rid of at least one of the for loops?
(I described the problem above instead of just giving the code because it might be helpful for someone to take a completely different approach, or check me (I think this is correct). Anyway if you are bored to check, any ideas regarding the speed would be more than welcome!).
Thanx in advance for any answers!
o...
can I run unix shell command in the ModelSim shell?Hi,
Just wonder if I can run unix shell command in the Modelsim shell,
expecially those time/date command?
Thanks.
clinton__bill@hotmail.com wrote:
> Hi,
> Just wonder if I can run unix shell command in the Modelsim shell,
> expecially those time/date command?
ModelSim uses Tcl as its scripting language so (almost) anything you can
do from Tcl can be done in ModelSim. Tcl has a variety of shell and file
interaction commands available. Of course, if you want to execute Unix
commands, you need to be running on a Unix (or Cygwin) system. Note that
Tcl commands are NOT direct...
Nested parfor loop: Classification of Matrix inside loopHello,
I am having problems with the following loop, since it is taking too much time. Hence, I would like to use parallel processing, specifically parfor function.
Can anyone, please, help me to convert the following 'far' loop into 'parfor'?
P = numel(scaleX); % quite BIG number
sz = P;
start = 1;
sqrL = 10; % sqr len
e = 200;
A = false(sz, sz);
parfor m = sz-sqrL/2:(-1)*sqrL:start
for n = M(m):-sqrL:1
temp = [scaleX(m), scaleY(m); scaleX(n), scaleY(n)];
d = pdist(temp, 'euclidean');
if d < e
A(m, n) = 1;
end
end
end
Thank you!
"Bek Abdik" <beknazar@unist.ac.kr> writes:
> I am having problems with the following loop, since it is taking too
> much time. Hence, I would like to use parallel processing,
> specifically parfor function.
>
> Can anyone, please, help me to convert the following 'far' loop into 'parfor'?
>
> P = numel(scaleX); % quite BIG number
> sz = P;
> start = 1;
> sqrL = 10; % sqr len
> e = 200;
> A = false(sz, sz);
>
> parfor m = sz-sqrL/2:(-1)*sqrL:start
> for n = M(m):-sqrL:1
> temp = [scaleX(m), scaleY(m); scaleX(n), scaleY(n)];
> d = pdist(temp, 'euclidean');
> if d < e
> A(m, n) = 1;
> end
> end
> end
As the code analyzer message informs you, the range of a PARFOR l...
Nested parfor loop: Classification of Matrix inside loop #2Hello,
I am having problems with the following loop, since it is taking too much time. Hence, I would like to use parallel processing, specifically parfor function.
Can anyone, please, help me to convert the following 'far' loop into 'parfor'?
P = numel(scaleX); % quite BIG number
sz = P;
start = 1;
sqrL = 10; % sqr len
e = 200;
A = false(sz, sz);
parfor m = sz-sqrL/2:(-1)*sqrL:start
for n = M(m):-sqrL:1
temp = [scaleX(m), scaleY(m); scaleX(n), scaleY(n)];
d = pdist(temp, 'euclidean');
if d < e
A(m, n) =...
redirecting StdinHi
Is is Possible to redirect the Python stdin in order to receive stdin
commands from a file ?
The time of redirection can last until exiting the Python and should
be transparent for python it self.
with regards
Jon
Jon Arter wrote:
> Is is Possible to redirect the Python stdin in order to receive stdin
> commands from a file ?
> The time of redirection can last until exiting the Python and should
> be transparent for python it self.
Sure:
sys.stdin = file('newinput')
--
Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
...
Unix ShellI'm new to RUBY, but am familar with other scripting languages, PHP,
Perl, Wscript, etc. I'd like to be able to run items from the shell
such as ls -l > dirlisting.txt. Just an example. Can I do this?
I would have just used the search on these forums, but unfortuantely
when I click Search I get "The page cannot be found". Hope they can
get this fixed so I won't have to ask every little question.
Thanks in advance.
-Greg
--
Posted via http://www.ruby-forum.com/.
Greg Johnson wrote:
> I'd like to be able to run items from the shell
> such as l...
if loop in UNIXHi all,
I have a doubt using IF loop in UNIX. I have the following statement.
if [[ `cat
/udb/db2enpid/clnpis/udb09/scripts/export_table_bluee_5/count_messages_begin_bluee|wc
-l` != 10 ]]
then
> print -- "not equal"
> else
> print -- "equal"
> fi
not equal
but when i do wc on the file it gives
cat
/udb/db2enpid/clnpis/udb09/scripts/export_table_bluee_5/count_messages_begin_bluee|wc
-l
10
The result i want to get out of the if loop is equal. Can somebody help
me please.
Thanks in advance
On 22 Nov 2006 06:53:33 -0800, chaitu wrote:
> Hi all...
WHILE LOOP AS FOR LOOPits possible?
For each id in (SELECT * FROM table)
INSERT INTO table2(id,fk,nombre)
values(1,id,'xxx');
Jessica Gonz�lez (jess.rgm@gmail.com) writes:
> its possible?
>
> For each id in (SELECT * FROM table)
> INSERT INTO table2(id,fk,nombre)
> values(1,id,'xxx');
>
So in SQL, you don't normally code the loops explicitly - the loops are
hidden on the inside. Logically, it is an operation of a set.
INSERT table(id, fk, nombre)
SELECT 1, id, 'xxx'
FROM table
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
thanks.. but
SET IDENTITY_INSERT table ON;
INSERT INTO table(pk,activo,permiso,rol)
SELECT IDENT_CURRENT('table')+1,'S',id, 1
FROM table2
return error
Violation of PRIMARY KEY constraint 'PK__table__3213E83F2B947552'. Cannot insert duplicate key in object 'table'. The duplicate key value is (6).
only 'id' i need get from table2
Jessica Gonz�lez (jess.rgm@gmail.com) writes:
> thanks.. but
>
> SET IDENTITY_INSERT table ON;
> INSERT INTO table(pk,activo,permiso,rol)
> SELECT IDENT_CURRENT('table')+1,'S',id, 1
> ...
how to have a while inside a for inside a while :(so, its like the inception movie, but i really need this, i know its easy but i cant figure it out
i am working with FEM and have to track one particle, every element has a unique velocity so i need them to update when they cross from one element to another
so its like this
%%%%%%%%%%%%%%%%%%%%%%%%%
dox=0;
doy=5;
while (dx<=2.8) || (dy>=4.8)
for i=1:5
while dx<=(a*i)
dx=dox+t*dhdx(141+i) % al pasar a i =2 el tiempo debe empezar de 0
dy=doy+t*dhdy(141+i)
dxVector=[dxVector; dx];
dyVector=[dyVector; dy];
dox=dx;
...
shell redirectHi,
Is it possible to redirect
stdout, stderr of the current shell
something like :
exec xx > test.log 2> test.err
Thanks in advance
astalavista wrote:
> Hi,
>
> Is it possible to redirect
> stdout, stderr of the current shell
> something like :
> exec xx > test.log 2> test.err
exec > test.log 2> test.err
(Not sure how that would make sense in an interactive shell, though.)
Janis
>
> Thanks in advance
>
>
"Janis Papanagnou" <Janis_Papanagnou@hotmail.com> a �crit dans le message de
news: fihv01$rv5$1@onli...
Unix shellHi all,
We offer free shells with web hosting and a spam-filtered email account.
- 50MB storage space (more available upon request)
- Domain hosting available upon request
- Access via SSH, SFTP, and POP3-ssl
- Instant messaging clients for IRC, AIM, MSN, ICQ, Yahoo!, Gadu-Gadu,
Jabber, and Lily
- FastTrack (KaZaA), SoulSeek, and BitTorrent clients
- Optional trainable server-side spam detection is also included.
We also have a few vhosts for fans of IRC.
Instant accounts available at: http://silenceisdefeat.org/
Anyway, I hope this is an acceptable place to let you guys know. If i...
For loop while loopI need to evaluate a function from 0:200 then create an
array of every 5th value in the 0:200 array using a for
loop then using a while loop.
I can't get the for loop to work at all because I cannot
use >,< controllers, only an =.
So I focused on the While loop:
n=0:200;%creates 201 cell array from 0-200
x=n.^2+.25;%calculates x
plotcol=(length(n)-1)/5;%=(201-1)/5=40
y=zeros(1,plotcol);%creates 1X40 vector
col=1;%used for incrementing in while loop
while col<=plotcol;
y(1,col)=x(1,5*col);
col=col+1;
end
Unfortunately the output starts at 16 when it should start
at 0. It seems like it should work to me, but something is
messed up. Any help would be appreciated.
"mpl " <mpl@mathworks.com> writes:
> I need to evaluate a function from 0:200 then create an
> array of every 5th value in the 0:200 array using a for
> loop then using a while loop.
>
> I can't get the for loop to work at all because I cannot
> use >,< controllers, only an =.
>
> So I focused on the While loop:
>
> n=0:200;%creates 201 cell array from 0-200
> x=n.^2+.25;%calculates x
> plotcol=(length(n)-1)/5;%=(201-1)/5=40
> y=zeros(1,plotcol);%creates 1X40 vector
> col=1;%used for incrementing in while loop
> while col<=plotcol;
> y(1,col)=x(1,5*col);
> col=col+1;
> end
>
> Unfortunately the output starts at 16 when it should start
> at 0. It seems like it should work to me, ...
loops in loopsIn the attached vi, the one second loop runs at one second and can't be touched. In the ten second loop, the ten second clock is a stand in for a process that generates a finished signal. The problem is once the process is complete, to start it again, leave the one second loop running, and start an additional process that will take less time than 10 seconds. thanks
internal loops.vi:
http://forums.ni.com/attachments/ni/170/319512/1/internal loops.vi
Hi exo,
what do you try there? If you start your vi, the value from your stop button will be read and after that, both loops "one" second and "ten" second won�t notice the state change of the stop button. Can you please explain, what you try to do??
Mike
Okay, let me try again. I need three loops. Two loops start at the same time one runs fast one runs slow. The slow one is probably independent to the problem. When the second loop is done, it needs to restart and start a third loop that takes less than the second.
You have a very basic dataflow problems. Unfortunately, I don't understand your description.
I would recommend starting with some basic LabVIEW tutorials.
Here are some obvious mistakes:
- Your loop cannot read changes in the stop button, because the terminal is outside the loop.
- You reset "internal loop" to zero in parallel to the loops. You cannot guarantee that this will happen before the locals are read so you might have a race c...
while loop in a while loopHi All,
I have the following situation:
while(rs.next()) { //loop1
while(rs2.next()) {
//loop 2
}
}
It seems like loop 2 is only beeing used once. Should I after loop2 put the
cursor back to the beginning? if so, how do I do that?
Thanks!
--
Posted by news://news.nb.nu
Steven wrote:
> Hi All,
>
> I have the following situation:
>
>
> while(rs.next()) { //loop1
>
> while(rs2.next()) {
> //loop 2
> }
>
> }
>
The architypal loop (for a List eg ArrayList of Blah objects) is:
for(It...
US-NJ-Jersey City: UNIX Developer, UNIX, Shell scripting, SwiftAlliance Access; (45335857612)US-NJ-Jersey City: UNIX Developer, UNIX, Shell scripting, SwiftAlliance Access; (45335857612)
=============================================================================================
Position: UNIX Developer
Reference: SMC01885
Location: Jersey City NJ
Duration: 7M
Skills: Knowledge of SwiftAlliance Access.
Exp in upgrading/migrating Swift Alliance Access, Swift
Alliance Gateway, SwiftNet Link.
Knowledge of Compliance and Watchlist filtering applications
like Mircosoft.
Knowledge of Banking, payment and messaging systems.
Exp with Unix, shell Scripting, MQ Series, Oracle, Crystal
Reports and WebSphere.
Strong analytical skills.
Ability to analyze a problem. own the problem and follow
thru to resolution. Production support experience with
critical systems.
Good written and oral communication skills.
Scope: Knowledge of Banking, payment and messaging systems.
Experience with Unix, shell Scripting, MQ Series, Oracle,
Crystal Reports and WebSphere. Strong analytical skills.
Ability to analyze a problem. own the problem and follow
thru to resolution. Production support experience with
critical systems. Good written and oral communication
skills.
Please send your...
US-NJ-Jersey City: UNIX Developer, UNIX, Shell scripting, SwiftAlliance Access; (45335557609)US-NJ-Jersey City: UNIX Developer, UNIX, Shell scripting, SwiftAlliance Access; (45335557609)
=============================================================================================
Position: UNIX Developer
Reference: SMC01885
Location: Jersey City NJ
Duration: 7M
Skills: Knowledge of SwiftAlliance Access.
Exp in upgrading/migrating Swift Alliance Access, Swift
Alliance Gateway, SwiftNet Link.
Knowledge of Compliance and Watchlist filtering applications
like Mircosoft.
Knowledge of Banking, payment and messaging systems.
Exp with Unix, shell Scripting, MQ Series, Oracle, Crystal
Reports and WebSphere.
Strong analytical skills.
Ability to analyze a problem. own the problem and follow
thru to resolution. Production support experience with
critical systems.
Good written and oral communication skills.
Scope: Knowledge of Banking, payment and messaging systems.
Experience with Unix, shell Scripting, MQ Series, Oracle,
Crystal Reports and WebSphere. Strong analytical skills.
Ability to analyze a problem. own the problem and follow
thru to resolution. Production support experience with
critical systems. Good written and oral communication
skills.
Please send your...
US-NJ-Jersey City: UNIX Developer, UNIX, Shell scripting, SwiftAlliance Access; (45335832409)US-NJ-Jersey City: UNIX Developer, UNIX, Shell scripting, SwiftAlliance Access; (45335832409)
=============================================================================================
Position: UNIX Developer
Reference: SMC01885
Location: Jersey City NJ
Duration: 7M
Skills: Knowledge of SwiftAlliance Access.
Exp in upgrading/migrating Swift Alliance Access, Swift
Alliance Gateway, SwiftNet Link.
Knowledge of Compliance and Watchlist filtering applications
like Mircosoft.
Knowledge of B...