help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error: scalar cannot be indexed with .


From: Etienne Grossmann
Subject: Re: error: scalar cannot be indexed with .
Date: Wed, 1 Sep 2021 07:25:38 -0700



On Wed, Sep 1, 2021 at 4:43 AM Lester Anderson <arctica1963@gmail.com> 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.png
For example, in an Octave prompt, I can provoke this error, but also do get(.,'color'):
image.png
    HTH,
    Etienne

----------
We are transitioning to a web based forum
for community help discussions at
https://octave.discourse.group/c/help

reply via email to

[Prev in Thread] Current Thread [Next in Thread]