I have a cell array whose elements show the positions of values in a selection in the workspace. Now I want to keep the same cell array, but replace the positions by the the values.
My cell:
res{1}=[55 56 57 58]
res{2}=[80 81]
res{3}=[111 112 113 114 115 116 117]
My Selection "Channel":
55: 0.1 56: 0.2 57: 0.3 58: 0.4
What I want:
res{1}=[0.1 0.2 0.3 0.4]
res{2}=....
I tried res={channel}
. But when I do this I only get one long vector.
res{1}
is the list of indices you want into channel
, right? So just take those and put them back into the original cell array. Since you have multiples, might as well wrap it in a loop:
for n = 1:numel(res)
res{n} = channel(res{n})
end
e.g. for res{1} = [55 56 57 58]
this is equivalent to res{1} = channel([55 56 57 58])