# array cell...... Find index from value

7 messages
Open this post in threaded view
|

## array cell...... Find index from value

 This post was updated on . hi, i'm this cell array of string : G example: G{1,2}=23 GG{2,2}=45 … GG{340,2}=98 i want Input: 98 and it return 340 it's possible using cellfun? i can't use it -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: array cell...... Find index from value

 GG{2,2}=45; GG{340,2}=98; a = cellfun (@(x) ~isempty (x) && (x == 98), GG(:,2)); find(a, 1, 'first') Is this what you wanted? Markus -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: array cell...... Find index from value

 This post was updated on . hi markus… it's not correct :( output: ans = [](0x1) -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: array cell...... Find index from value

 It works for me with Octave 4.4.0 and 4.2.2. Did you copy and paste the 4 lines from my reply? Maybe it would help to run "clear all" before. What do you get for "which cellfun"? Markus -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: array cell...... Find index from value

 i writed GG as example. But i need to execute code on this array cell: GG  [7,2] =   [8,2] =   [9,2] =   [10,2] =   [11,2] =   [12,2] =   [13,2] =   [14,2] =   [15,2] =   [16,2] =   [17,2] =   [18,2] =   [19,2] =   [20,2] =   [21,2] =   [22,2] =   [23,2] = 123   [24,2] =   [25,2] =   [26,2] =   [27,2] =   [28,2] =   [29,2] =   [30,2] =   [31,2] =   [32,2] =   [33,2] =   [34,2] =   [35,2] =   [36,2] =   [37,2] =   [38,2] =   [39,2] =   [40,2] =   [41,2] =   [42,2] =   [43,2] =   [44,2] =   [45,2] =   [46,2] =   [47,2] =   [48,2] =   [49,2] =   [50,2] =   [51,2] =   [52,2] =   [53,2] =   [54,2] = 122   [55,2] =   [56,2] =   [57,2] =   [58,2] = here there is several null cells.. i've try this code: >> a = cellfun (@(x) ~isempty (x) && (x ==122), string_dat_rp(:,2)); >> find(a, 1, 'first') ans = [](0x1) -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html