[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Arrays of Strings
From: |
Ben Abbott |
Subject: |
Re: Arrays of Strings |
Date: |
Tue, 26 Apr 2011 11:12:38 -0400 |
On Apr 26, 2011, at 10:38 AM, Peter Norlindh wrote:
> Hi,
>
> I have formed an array, B, of strings.
>
> A = ["one"; "two"; "three"];
> B = cellstr (A);
>
> I would like to use the individual strings in a function, but cannot get to
> them. For example:
>
> B (1, 1)
> >> [1,1] = one (..as opposed to >>"one", which is what I want)
>
> How can I fish out the strings "one", "two" and "three"?
>
> /hpon
You can do what you want by using the curly parentheses to index the cell.
B = {"one", "two", "three"};
B{1}
ans = one
Ben