[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "error: can't perform indexing operations for range type" using Octa
From: |
Kai Torben Ohlhus |
Subject: |
Re: "error: can't perform indexing operations for range type" using Octave 4.2.2 |
Date: |
Tue, 28 May 2019 09:56:35 +0200 |
On Mon, May 27, 2019 at 3:09 AM RT <address@hidden> wrote:
>
> I'm using octave 4.2.2 and I'm getting an error message
> "error: can't perform indexing operations for range type"
>
> The error seems to be with the t_grp variable / line?
>
> clear, clc, clf,close all
> yy2_round = [1.2 2.5 1.2 4.2 2.5 2.5 8.1 10.2 4.2 4.2 4.2];
> t2=1:length(yy2_round);
>
> % Get unique values of yy2
> unique_vals = unique(yy2_round);
>
> % Get index groups for each unique yy2 value in a cell array
> idx_grp = arrayfun(@(v) find((yy2_round ==
> v)),unique_vals,'UniformOutput',false);
>
> % Get t2 groups for each unique yy2 value in a cell array
> t_grp = cellfun(@(v) t2(v),idx_grp,'UniformOutput',false);
>
> % Get yy2 groups for each unique yy2 value in a cell array
> yy2_grp = cellfun(@(v) yy2_round(v),idx_grp,'UniformOutput',false);
>
> -
> I'm using Ubuntu 18.04 64bit Octave 4.2.2
>
I can confirm this error for Octave 4.2.2, but it does not occur in
4.4.1 and newer. It must have been fixed at some point, but I cannot
point to a bug report or changeset. So if possible try to upgrade
Octave. For your Ubuntu installation it is possible to use the
Flatpack [1] installation method for example.
Best,
Kai
[1] https://flathub.org/apps/details/org.octave.Octave