arrays - How to replace a line from another file MATLAB -


i have cell array this:

m =  [002]  [a] [0] [0]   [0]     [381]  [002]  [b] [0] [0]   [0]     [166]  [002]  [c] [0] [0]   [0]     [136]  [002]  [d] [0] [0]   [0]     [880]  [003]  [e] [0] [0]   [0]     [839]  [003]  [f] [0] [0]   [0]     [156]  [003]  [g] [0] [0]   [0]     [789]  [003]  [h] [0] [0]   [0]     [676]  [003]  [i] [0] [0]   [0]     [778]  [004]  [j] [0] [0]   [0]     [787] 

and have input file contain:

[x] [4] [3]  [e]      [839] [y] [7] [4]  [f]      [156] [z] [8] [1]  [i]      [778] 

i want third column second file ([e], [f], , [i]) indices find value in m , replace row in m (but didnt change first column of m), new matrix this:

n =  [002]  [a] [0] [0]   [0]     [381]  [002]  [b] [0] [0]   [0]     [166]  [002]  [c] [0] [0]   [0]     [136]  [002]  [d] [0] [0]   [0]     [880]  [003]  [x] [4] [3]   [e]     [839]  [003]  [y] [7] [4]   [f]     [156]  [003]  [g] [0] [0]   [0]     [789]  [003]  [h] [0] [0]   [0]     [676]  [003]  [z] [8] [1]   [i]     [778]  [004]  [j] [0] [0]   [0]     [787] 

how can that?

use ismember.

n = m;                                     %making copy of m n(ismember(m(:,2),inp(:,4)),2:end) = inp;  %replacing desired terms input 

read: access data in cell array


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -