extract data from cell array based on matching numbers with location in array

2 views (last 30 days)
Hi I have a cell array MyData which has 128x1 cells with data running sequentially from A1 to A32 and again for B1-B32, C1-C32 and D1-D32. Can anyone advise how I extract data from this array based on whether the location in this array matches that of a number? For example, if I have A how do I get the desired output B?
MyData = [sprintfc('A%i',1:32) sprintfc('B%i',1:32) sprintfc('C%i',1:32) sprintfc('D%i',1:32)]'
A = [1 34 68 92 118]'
B =[A1 B2 C4 C28 D22]

Accepted Answer

Stephen23 on 24 Aug 2020
Edited: Stephen23 on 24 Aug 2020

More Answers (0)


Find more on Cell Arrays in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!