f

#### 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;
doy=dy;
t=t+1;
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%

the while inside works fine, the for work fine too, but i want to start always with the frist while, he is my real condition.
so when the particles cross the (dx<=2.8) || (dy>=4.8) (one or the another condition)

but what its does, that he finishe the for, and them goes to the upper while.
i tried using break, continue.

tnx!
```
 0
juan
10/9/2015 9:51:03 PM
comp.soft-sys.matlab 211266 articles. 19 followers. lunamoonmoon (257) is leader.

1 Replies
3022 Views

Similar Articles

[PageSpeed] 45

```On 10/9/2015 4:51 PM, juan correa wrote:
> 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;
>          doy=dy;
>          t=t+1;
>          tVector=[tVector; t]; %%YA AFINADO (+1).
>          end
>        end
>      end
> %%%%%%%%%%%%%%%%%%%%%%%%%%
>
> the while inside works fine, the for work fine too, but i want to start always with the frist while, he is my real condition.
> so when the particles cross the (dx<=2.8) || (dy>=4.8) (one or the another condition)
>
> but what its does, that he finishe the for, and them goes to the upper while.
> i tried using break, continue.
>
> tnx!
>

it is hard to understand what you are asking. You could have

You wrote

while some_condition
for i=1:5
while some_other_condition
...
end
end
end

The above makes little sense, since the for loop will iterate 5 times
any way.

If you mean you wanted an inner loop that iterates at most 5 times,
but breaks when the inner condition is met, you can do

while some_condition
i=1;
while some_other_condition && i<=5
...stuff that could change some_other_condition to be false
i=i+1;
end
end

--Nasser

```
 0
Nasser
10/9/2015 10:14:43 PM

Similar Artilces:

Inside to Inside NAT
I'm trying to configure my c837 to use inside-to-inside NAT, but I'm not getting anywhere, and everywhere I've looked on the Internet regarding this problem seams to tail off without resolve... Basically, I'm trying to access my internal web server using the global IP address assigned to Dialer0 on the router by my ISP. I have a DNS service external to the network which is provided this IP address and while I can use it externally (PAT from the Internet to the LAN is working fine), I can't get it to work when I'm on the network. In this case, internal replicat...

how to make a canvas expand inside a frame inside a notebook inside a panedwindow
Hi, I am laying out some widgets and face the problem how to make a canvas expand when the toplevel window is resized. A ttk::treeview and a ttk::notebook are added to a ttk::panedwindow and the panedwindow is pack'ed -expand 1 -fill both into the toplevel. I use the treeview to control which page of the notebook is visible. Inside each notebook page, I have a frame which contains a canvas. (one frame and one canvas per notebook page) Currently I use pack configure .panedwindow.frame.canvas -expand 1 -fill both pack configure .panedwindow.frame -expand 1 -fill both when each page of the n...

Inside the MATLAB Desktop Blog on MATLAB Central
Hello, The MATLAB Desktop team is joining the MATLAB blog community and recently introduced the "Inside the MATLAB Desktop" blog. The entire Desktop development team will be contributing to the content of this blog to give you information about features that you may not have found in the product and productivity tips. We also will introduce new features as they are released. The blog can be found over on MATLAB Central or at the following link: http://blogs.mathworks.com/desktop/ For more information about who we are and what the "Desktop team" works on, check ...

executing a matlab compiled application inside Matlab on Linux
Hi all Just a quick question. Is there a command similar to !mycompiledapp on Windows that i can do to execute a compiled application inside Matlab but on a Linux platform? Thanks in advance, Ana On Mar 8, 10:22 pm, "Ana Alvarez" <ana.alvarez-m...@airbus.com> wrote: > Hi all > > Just a quick question. > > Is there a command similar to !mycompiledapp on Windows > > that i can do to execute a compiled application inside Matlab but on > a Linux platform? > > Thanks in advance, > > Ana If "!" doesnt work, try the system command :...

Array inside struct inside container
I've seen forum posts here and there asking "How do I create an STL container of arrays?" Or, equivalently, "How do I fix this syntax:" std::vector<float[20]> v; The answers to these questions are generally one of two things: 1) Use a boost::array, or 2) Put the array in a struct, like so: // In header file stuct wrapper { float f[20]; }; // In CPP file std::vector<wrapper> v; I was under the impression that things stored in STL containers needed to be copyable and assignable. That second option seems incorrect to me, unless the com...

variable declaration inside eval inside with
Hello, consider the next code: var obj = {}; with(obj) { var x = 10; } print(x); print(obj.x); It prints 10 and undefined. Here, one could expect that obj.x get the value 10. But it's not the case, because variable declarations are placed at the start of function code (or global code), so the previous code is equivalent with: var obj; var x; obj = {}; with(obj) { x = 10; } print(x); print(obj.x); You can clearly see now that x is placed in the outer context. But consider the next: var obj = {}; with(obj) { eval("var x = 10;"); } print(x); print(obj.x); I was e...

Create (Matlab) object inside C/C++ and pass it to Matlab
I'm trying to create an object inside C++ and then pass it to Matlab via en= gPutVariable. It seems I can create a struct // Create a float array mxArray *acq_data =3D mxCreateNumericMatrix(0, 0, mxSINGLE_CLASS); float *data =3D (float *)mxCalloc(M*N, sizeof(float)); mxSetData(acq_data, data); mxSetM(acq_data, M); mxSetN(acq_data, N); // Convert to struct const char *fieldname =3D "data"; mxArray *acq_struct =3D mxCreateStructMatrix(1,1,1, &fieldname); mxSetField(acq_struct,i,"data",acq_data); // Convert to class ?? Does it work? if (j=3D=3D1...

break inside of case- statement inside of loop
Hi! I have some code that looks similar to this: -------------------------------------------- char array[10] = "abcdefghij"; for (int i = 0; i < 10; i++) { switch (array[i]) { case 'a': /* code */ break; case 'b': /* code */ break; case 'c': /* code */ break; default: /* code */ break; } } -------------------------------------------- Is it possible to break out of the for loop from inside of one case- statement, or do I have to use a workaround? In article <1172402165.914050@nntpcache01.si.eunet.at>, Alexan...

drag div from inside div to inside another
Hi all, ########example HTML:########## <div id="holder1" class="draggable"> <div id="mover" class="draggable">moveme</div </div> </div id="holder2" class="draggable"></div> ########################## Is it possible to drag <div id="mover"> from <div id="holder1"> in to <div id="holder2"> so that the 'mover' becomes attached to the 'holder' In the above structure I can drag 'holder1' and 'mover' will stick to it, ...

Configuring an inside nat group on inside interface
Here is an interesting problem.. I am missing something very simple. I have a pix that I want to setup as a vpn server. I am using the easy client software. I have a pool of ip addresses. This is a pool that I picked out of the blue not in use, 192.168.254.0/24. I have no problem getting the remote client to authenticate and get an ip address from the pix in this range. I do not have any control of the internal router, 172.16.0.1. The inside interface has an ip address on the inside network, 172.16.0.2 and I have confirmed connectivity. If I put in the correct routes, I can ping from the pix...

inside-outside-inside issue on PIX 506E
Anyone have the issue where outside IP's can access an internal server via URL or outside IP but inside computers can not access the internal server via URL or outside IP? When an outside IP accesses the web server, a show xlate gives you the inside,outside translation, but if I try from my internal machine, nothing shows up on the show xlate list and it times out with 'page not found'. I know some routers/firewalls have issues going inside, outside, and back inside, but I would think Cisco would be able to do this. I know I am missing something somewhere. I know the '...

do inside a do
I was trying to create a function that given two initial parameters, it would iterate through a specific part of an array. I'm tryng to create this with two do's one inside the other, but i'm not getting results. here's a sample of my code in side the fubction: (do ((n sl (1+ n))) ((= n el) count) (do ((k sc (1+ k))) ((= k ec) )) (if (eq (give-numnber array n k) number) (incf count))) count)) the compiler says K is neither declared nor bound, | it will be treated as if it were declared SPECIAL. what i'm a doing ...

Outline inside Outline or list inside ist
Here, question: how to allow Outline almost like what Word would allow one to do? Primary browser to support is Firefox for now. Currently I'm using the execCommand function and the InsertOrderedList command identifier, so, it is able to create ordered list (just consider it as outline for now), and it looks like this: 1. apple 2.orange 3.banana What I'd like to do is, to go a step further, to achieve the following: 1. apple 1.1 apple cyder 1.2 apple pie ... 2.orange 3.banana But I'm unable to accomplish it. Thought or pointer would be much appreciate. On Mar 3, 7:...

a = a(:) inside out
Hi, I am wondering, how a = a(:) is internally computed. For instance, if we have a = ones( 1, n ); a = a(:); Isn't it efficient just switching the number of rows and cols in mxArray than creating a new array and doing a memberwise copy? Of course, for the former, we need passing by reference which MATLAB doesn't allow. Any thoughts please Chris On Oct 26, 1:23 pm, Chris <chris.ty...@whatever.com> wrote: > Hi, > I am wondering, how a = a(:) is internally computed. For instance, if > we have > > a = ones( 1, n ); > a = a(:); > > Isn't it efficient...

Web resources about - how to have a while inside a for inside a while :( - comp.soft-sys.matlab

Inside Intercom
Brought to you by the team behind Intercom . We write about design, customer experience, start-ups, and the business of software.

Inside plant - Wikipedia, the free encyclopedia
... GR-513, Power Requirements in Telecommunications Plant (LSSGR Section 13) , contains detailed industry requirements for using power in an inside ...

Announcing Inside Social Apps NYC 2012
We’re excited to announce the first East-Coast edition of Inside Social Apps , happening in New York Dec. 3. This full-day conference will include ...

Inside Amazon’s deal to acquire Portland-based Elemental
Amazon’s (Nasdaq: AMZN) acquisition of a Portland-based startup could be as important for the development of Oregon’s technology industry as ...

iPad exclusive: Inside the Kelly Brennan murder investigation - 48 Hours Videos - CBS News
Major Tod Goodyear of the Brevard County Sheriff's Office shows "48 Hours"' Peter Van Sant the steps investigators believe convicted murderer ...

Step inside the Guggenheim with Google
Google's culture project now lets you visit a thousand museums online. Its next step is to deliver immersive gallery experiences via the Google ...

Go Inside The Work Of Salvador Dali With Surreal New Virtual Reality Experience
An early painting comes to life for The Dal Museum's new &quot;Disney and Dal: Architects of the Imagination&quot; exhibit.

Inside The Growing Social Media Skills Gap
Hootsuite CEO Ryan Holmes explains why the skills gap you haven't heard of is getting wider, and what it takes to close it. On February 4, 2004, ...

Inside The Blissed-Out Neuroscience Of Being In Love
Can we measure love by neuroscience? This question was originally answered on Quora by Yohan John.

Inside ‘Outsiders’: Behind the scenes of WGN America’s show
WGN America's new show 'Outsiders' takes viewers into the lives of an Appalachian family that has been living off the grid for more than 200 ...

Resources last updated: 1/25/2016 3:39:51 AM