## How to create and store a plot for each iteration of a Do loop

I have created the following code below. Its purpose is for me to divide the plot into grids and for each grid I reterive the center point’s co-ordinates.

``dp = DensityPlot[(E^-(x^2 + y^2)^2)^2 + ((E^-(x^2 + y^2)^2) (x^2 +           y^2) Cos[2 Pi])^2, {x, -3, 3}, {y, -3, 3},     PlotTheme -> "Minimal", PlotRange -> All, PlotPoints -> 50,     ColorFunction -> "Rainbow"]; ClearAll[centers2] centers2[region_ : Disk[{0, 0}, 1]][{nc_, nr_}, {xrange_, yrange_}] :=   Select[RegionMember[region]]@centers[{nc, nr}, {xrange, yrange}] {xrange, yrange} = {{-3, 3}, {-3, 3}};  {nc, nr} = {10, 10};   Show[dp, Graphics[{White, PointSize[Medium], Circle[],     Point@centers2[][{nc, nr}, {xrange, yrange}]}]] means[n_] := MovingAverage[Subdivide[##, n] & @@ #, 2]; &;       cp = centers2[][{nc, nr}, {xrange, yrange}]  ``

Next I have made a Do loop that will perform calcualtions to get a variable called angle. This code is given below.

``Do[point = Part[cp, i]; x = Part[point, 1]; y = Part[point, 2];   ex = (E^-(x^2 + y^2)^2)^2;   ey = ((E^-(x^2 + y^2)^2) (x^2 + y^2) Cos[2 Pi])^2;  s1 = ex^2 - ey^2;  s2 = 2 ex ey Cos[0];  inside = 2 s2/s1;  angle = ArcTan[inside], {i, Length[cp]}] ``

Now what I would like to have a command inside the Do loop that I can use to plot an ellipse based on the variable angle (this will be used to give the angle that the semi major axis makes with the x axis) for very iteration of the Do loop. There is a constant semi and minor axis. The point the ellipse will have to be centered at is the point that is currently being used in the Do loop.

I am not sure how to do this inside the loop for all the iterations, however I have a found a method to plot an ellipse given as

``ellipsoid[center_, {majorradius_, minorradius_}, angle_] :=   GeometricTransformation[   Ellipsoid[center, {majorradius, minorradius}],    RotationTransform[angle, center]] ad = Pi/3; sd = Graphics[{EdgeForm[{Thick}], Opacity[.75], Transparent,     ellipsoid[{0, 0}, {0.2, 0.1}, ad], Opacity[1], Red, Point[{0, 0}],}] Plot[3, sd, {x, -10, -10}] ``

I also would like to store these plots as I would like to then combine all of these ellipse plots onto the densityplot I have made in the beginning

All help is much appreciated

## How to make the loop to get to the end and stop at the end?

This is what I’m trying to archive and it’s almost working fine :

``using System.Collections; using System.Collections.Generic; using UnityEngine; using FIMSpace.FLook;  public class Test : MonoBehaviour {     public FLookAnimator lookAnimator;     public Transform[] targets;     public float switchingTime;     public bool switchingLoop = false;      private bool loopOnce = true;      // Start is called before the first frame update     private void Start()     {         StartCoroutine(SwitchTargetsPeriodically());     }      private void Update()     {      }      IEnumerator SwitchTargetsPeriodically()     {         for (int i = 0; true; i = (i + 1) % targets.Length)         {             if (i < targets.Length - 1 && switchingLoop)             {                 loopOnce = true;                  lookAnimator.ObjectToFollow = targets[i];             }              if (switchingLoop == false && loopOnce)             {                 if (i < targets.Length - 1)                 {                     lookAnimator.ObjectToFollow = targets[i];                   }                 else                 {                     loopOnce = false;                 }             }              yield return new WaitForSeconds(switchingTime);         }     } } ``

The problem it’s looping the targets.Length – 1 and if I change it to targets.Length then it will not loop at all. but if I’m doing targets.Length – 1 it will loop between 3 targets but there is 4 targets.

## I want to show the category image (set with ACF) inside a loop that shows it inside the cards, how can I do it?

``<?php get_header();   \$  category = get_category( get_query_var( 'cat' ) ); \$  cat_id = \$  category->cat_ID;  \$  id_cat = array('parent' => \$  cat_id); \$  categories = get_categories( \$  id_cat ); ``

// Get particular category’s object info. \$ queried_object = get_queried_object();

// (Optional depending on desired outcome) If you wanted to get the type of taxonomy. \$ taxonomy = \$ queried_object->taxonomy;

// (Optional depending on desired outcome) If you wanted to get the associated ID. \$ term_id = \$ queried_object->term_id;

// Get image ID for this field. \$ attachment_id = get_field( ‘category_image’, \$ queried_object );

// URL of image at specific size. \$ image = \$ attachment_id[‘sizes’][‘chosen-image-size’];

``?> ``
``<section class="p-5">     <div class="container">         <div class="row text-center">             <h3><?php single_cat_title(); ?></h3>             <p><?php category_description(); ?></p>         </div>     </div> </section>  <section>     <div class="container animated">         <div class="row d-flex" data-masonry='{"percentPosition": true }'> ``

‘.’ term_id ).'”>’ .\$ category->name.”.’ ‘; } ?>

### In evidenza

``            <?php while(have_posts()): the_post(); ?>                 <div class="col-6 col-md-4 col-xl-3 mb-4">                     <div class="card text-center">                         <a href="<?php the_permalink() ?>">                                         <!-- Immagine Articolo -->                             <?php if(has_post_thumbnail()): ?>                                   <div class="m-1"><?php the_post_thumbnail('thumbnail') ?></div>                             <?php endif; ?>                         </a>                             <div>                             <h3><?php the_title(); ?></h3>                             <p><?php the_excerpt(); ?></p>                         </div>                         <a href="<?php the_permalink() ?>" class="btn btn-outline-dark btn-sm">Continua a                             Leggere</a>                     </div>                 </div>                     <?php endwhile; ?>                     <?php else: ?>                         <?php echo wpautop('ops.. non ho trovato nulla');?>                     <?php endif; ?>         </div>     </div> </section> ``

## Saving data from for loop to file and then read the data and plot graphs

I have a for loop which generates random matrices, then performs a few calculations to yield a bunch of different values. Essentially, something like so: `For[j = 1, j < 100, j++, a={{1}{2}{3}{4}},b={{5}{6}{7}{8}},c=Tr[a],d=Tr[b], e=c+d, {a,b,c,d,e}>>> file]`

Of course in the above, we repeat the same values over and over, I am using this as an example as the script would be too long and requires a list of different packages. I need to save these values to a file in a way that I can then extract the values and create a bunch of different graphs. What is the best way to go about this?

## how can i get the following figure using the for loop

how can i get the following figure using the for loop.

``n=5 For[i=1,i<5,i++,For[j=1,j<n,j++,A=(i+j)]] A//MatrixForm ``

The code I found is above but not working.where is the mistake?

I want to loop every single item in the menu with the walker class.

``class Primary_Walker_Nav_Menu extends Walker_Nav_Menu {     public \$  bg;      function __construct() {         \$  this->bg = get_field('navigation_menu_background_image', 'option'); //acf array in function.php     }           } ``

In `\$ this->bg` are an array of images, I want to have `\$ depth` less from 0, which means the only the first item in-depth, not sub-menu, nothing else.

My idea is to loop `\$ i` item and get `\$ bg` item on position `\$ i`, how to do this?

Help, thanks!

## Loop categories with query

Is it possible to create a query for get the categories and sub categories? I want a more advanced query for this and get_terms or get_categories is not enough for me.

## help with while loop

Hi, in changeing from MYSQL to MYSQLi (that's where the blame goes) I can't get a clear understanding as to the proper code
for the while loop. help please. code follows:
——————————————————
<html><body>
<hr>
<center><b><font size=+2> 515 Certification Expiration Report</font><br>06/22/2020 – 06/22/2021<p>

<hr>

<?php
//Open a new connection to the MySQL server
require_once "getprerentdb.php";

//MySqli Select Query
\$ results = \$ mysqli->query (SELECT * FROM…

help with while loop