selecting particular elements from a cell array
3 次查看(过去 30 天)
显示 更早的评论
Dear all,
I have the following cell array
A={
[ 0] [ 0] [ 0] [1.2923] [11.2337]
[ 0] [ 0] [ 0] [1.2923] [11.2337]
'MN1' [ 0] [ 0] [1.2923] [11.2337]
'MN1' [ 0] [ 0] [1.2868] [11.2569]
'MN1' 'AER_KL1' [ 0] [1.3125] [11.5218]
'MN1' 'AER_KL1' [ 0] [1.2906] [11.0013]
'MN1' 'AER_KL1' [ 'B1'] [2.9102] [28.2414]
'MN1' 'AER_KL1' [ 'B1'] [2.9961] [29.4252]
'MN1' 'AER_KL1' [ 'B1'] [3.0740] [29.4386]
'MN1' 'AER_KL1' [ 'B2'] [2.8701] [27.8087]
'MN1' 'AER_KL1' [ 'B2'] [2.9805] [29.6135]
'MN1' 'AER_KL1' [ 'B2'] [2.9793] [29.5466]
'MN1' 'AER_KL1' [ 'B3'] [2.9102] [28.2414]
'MN1' 'AER_KL1' [ 'B3'] [2.9961] [29.4252]
'MN1' 'AER_KL1' [ 'B3'] [3.0740] [29.4386]
'MN1' 'AER_KL2' [ 0] [1.3125] [11.5218]
'MN1' 'AER_KL2' [ 0] [1.2906] [11.0013]
'MN1' 'AER_KL2' [ 'B1'] [2.8701] [27.8087]
'MN1' 'AER_KL2' [ 'B1'] [2.9805] [29.6135]
'MN1' 'AER_KL2' [ 'B1'] [2.9793] [29.5466]
'MN1' 'AER_KL2' [ 'B2'] [2.9102] [28.2414]
'MN1' 'AER_KL2' [ 'B2'] [2.9961] [29.4252]
'MN1' 'AER_KL2' [ 'B2'] [3.0740] [29.4386]
'MN1' 'AER_KL2' [ 'B3'] [2.8701] [27.8087]
'MN1' 'AER_KL2' [ 'B3'] [2.9805] [29.6135]
'MN1' 'AER_KL2' [ 'B3'] [2.9793] [29.5466]
'MN1' [ 0] [ 0] [1.2923] [11.2337]
'MN1' [ 0] [ 0] [1.2868] [11.2569]
'MN1' [ 0] [ 0] [1.3125] [11.5218]
'MN1' [ 0] [ 0] [1.2906] [11.0013]
'MN2' [ 0] [ 0] [1.2923] [11.2337]
'MN2' [ 0] [ 0] [1.2868] [11.2569]
'MN2' 'AER_KL1' [ 0] [1.3125] [11.5218]
'MN2' 'AER_KL1' [ 0] [1.2906] [11.0013]
'MN2' 'AER_KL1' [ 'B1'] [2.9102] [28.2414]
'MN2' 'AER_KL1' [ 'B1'] [2.9961] [29.4252]
'MN2' 'AER_KL1' [ 'B1'] [3.0740] [29.4386]
'MN2' 'AER_KL1' [ 'B2'] [2.8701] [27.8087]
'MN2' 'AER_KL1' [ 'B2'] [2.9805] [29.6135]
'MN2' 'AER_KL1' [ 'B2'] [2.9793] [29.5466]
'MN2' 'AER_KL1' [ 'B3'] [2.9102] [28.2414]
'MN2' 'AER_KL1' [ 'B3'] [2.9961] [29.4252]
'MN2' 'AER_KL1' [ 'B3'] [3.0740] [29.4386]
'MN2' 'AER_KL2' [ 0] [1.3125] [11.5218]
'MN2' 'AER_KL2' [ 0] [1.2906] [11.0013]
'MN2' 'AER_KL2' [ 'B1'] [2.8701] [27.8087]
'MN2' 'AER_KL2' [ 'B1'] [2.9805] [29.6135]
'MN2' 'AER_KL2' [ 'B1'] [2.9793] [29.5466]
'MN2' 'AER_KL2' [ 'B2'] [2.9102] [28.2414]
'MN2' 'AER_KL2' [ 'B2'] [2.9961] [29.4252]
'MN2' 'AER_KL2' [ 'B2'] [3.0740] [29.4386]
'MN2' 'AER_KL2' [ 'B3'] [2.8701] [27.8087]
'MN2' 'AER_KL2' [ 'B3'] [2.9805] [29.6135]
'MN2' 'AER_KL2' [ 'B3'] [2.9793] [29.5466]
[ 0] [ 0] [ 0] [1.2923] [11.2337]
[ 0] [ 0] [ 0] [1.2868] [11.2569]
[ 0] [ 0] [ 0] [1.3125] [11.5218]
[ 0] [ 0] [ 0] [1.2906] [11.0013]
}
I want to select all the numbers from the last 2 columns that correspond to the string variables of column 3 (in the above example 'B1' 'B2' 'B3') AND the the string variables of column 1 (in the above example 'MN1' 'MN2')
So, I want to obtain
A_new={
'MN1' [ 'B1'] [2.9102] [28.2414]
'MN1' [ 'B1'] [2.9961] [29.4252]
'MN1' [ 'B1'] [3.0740] [29.4386]
'MN1' [ 'B2'] [2.8701] [27.8087]
'MN1' [ 'B2'] [2.9805] [29.6135]
'MN1' [ 'B2'] [2.9793] [29.5466]
'MN1' [ 'B3'] [2.9102] [28.2414]
'MN1' [ 'B3'] [2.9961] [29.4252]
'MN1' [ 'B3'] [3.0740] [29.4386]
'MN1' [ 'B1'] [2.8701] [27.8087]
'MN1' [ 'B1'] [2.9805] [29.6135]
'MN1' [ 'B1'] [2.9793] [29.5466]
'MN1' [ 'B2'] [2.9102] [28.2414]
'MN1' [ 'B2'] [2.9961] [29.4252]
'MN1' [ 'B2'] [3.0740] [29.4386]
'MN1' [ 'B3'] [2.8701] [27.8087]
'MN1' [ 'B3'] [2.9805] [29.6135]
'MN1' [ 'B3'] [2.9793] [29.5466]
'MN2' [ 'B1'] [2.8701] [27.8087]
'MN2' [ 'B1'] [2.9805] [29.6135]
'MN2' [ 'B1'] [2.9793] [29.5466]
'MN2' [ 'B2'] [2.9102] [28.2414]
'MN2' [ 'B2'] [2.9961] [29.4252]
'MN2' [ 'B2'] [3.0740] [29.4386]
'MN2' [ 'B3'] [2.8701] [27.8087]
'MN2' [ 'B3'] [2.9805] [29.6135]
'MN2' [ 'B3'] [2.9793] [29.5466] }
I am looking for a code that can identify and select all
the string variables of column 1 AND string variables of column 3 and then find the numbers that correspond
to these string variables
Is there a way of doing that?
thanks
1 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!