octave-maintainers
[Top][All Lists]
Advanced

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

Re: convert cell in string


From: Daniel J Sebald
Subject: Re: convert cell in string
Date: Fri, 13 Jul 2018 22:06:56 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/13/2018 06:48 PM, turbofib wrote:
hi,
i want to convert cell in string

Example :

  typeinfo(g)

ans = cell


how can i do to convert?

I sent an email to turbofib about options.

In experimenting I came across a couple things.

1) I wonder if some structure element names should be disallowed because they can't be accessed directly; only via the getfield() function. Some examples:

octave:62> g = {"A","B","C"};
octave:63> s = cell2struct(g, ".");
octave:64> s..
parse error:

  syntax error

>>> s..
      ^

octave:64> getfield (s(2), ".")
ans = B
octave:65> s = cell2struct(g, " ");
octave:66> s.
parse error:

  syntax error

>>> s.
      ^

octave:66> s = cell2struct(g, "9");
octave:67> s.9
parse error:

  syntax error

>>> s.9
      ^

It's fine I suppose, but just strange.


2) Should the following be allowed?

octave:69> [~ s1 s2] = g{:}
parse error:

  invalid left hand side of assignment

>>> [~ s1 s2] = g{:}

The tilde can be at the end of the argument list without error, but nowhere else.

Dan



reply via email to

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