Re: error: scalar cannot be indexed with .
Etienne Grossmann <[email protected]> Wed, 1 Sep 2021 07:25:38 -0700
| Newsgroups | gmane.comp.gnu.octave.general |
|---|---|
| Message-ID | <CANEe7Pw2v2aaV7Wjse+VzqVKOSkKyh0cdC59101TE-ARH0irTQ@mail.gmail.com> |
On Wed, Sep 1, 2021 at 4:43 AM Lester Anderson <[email protected]> wrote: > Hello, > > I am trying to run the attached code, but it fails at line 51 > Input parameters: > >> obs(1) = > struct('type','fixed','r',2,'phi',pi/4,'pulsePeriod',0.5,'n',400) ; > >> obs(2) = > struct('type','free','r',1.5,'phi',pi/4,'pulsePeriod',0.5,'n',400) ; > >> run_Schwarzschild(obs,8,[0 2.5 0 2.5]) > error: scalar cannot be indexed with . > error: called from > run_Schwarzschild at line 51 column 10 > > Not sure how to solve this? > > Lester > Hi Lester, my bet is: the o(k).Color (line 51) is the problem. o(k) is defined line 42. o(k).Color could be a Matlabism not supported in Octave? You may want to replace it w/ get(ok(k), 'color'). [image: image.png] For example, in an Octave prompt, I can provoke this error, but also do get(.,'color'): [image: image.png] HTH, Etienne ---------- > We are transitioning to a web based forum > for community help discussions at > https://octave.discourse.group/c/help > ---------- We are transitioning to a web based forum for community help discussions at https://octave.discourse.group/c/help
image.png
(image/png, 36.1 KB) - not displayed
image.png
(image/png, 9.1 KB) - not displayed