I have two cellArray which class are cell. I want to extract first column of these cellArray.

1 次查看(过去 30 天)
cellArray=
' 334 4261461.0645 2661117.6797 3918916.0472'
' 352 4266205.852 2659683.96 3914798.2885'
' 404 4258400.8221 2662966.354 3920634.872'
' 414 4255211.3943 2666063.0462 3921735.7546'
%cellArray 8x1 1824 cell
I want to create a matrix form of this cellArray and extract first column.
(334-352-404-414)
cellArray2=
' N334 4261461.0645 2661117.6797 3918916.0472'
' N352 4266205.852 2659683.96 3914798.2885'
' N404 4258400.8221 2662966.354 3920634.872'
' N414 4255211.3943 2666063.0462 3921735.7546'
%I wanna extract first column of this cellArray2 if we think this is a matrix.
(N334-N352-N404-N414)

采纳的回答

Andrei Bobrov
Andrei Bobrov 2013-7-9
cellArray ={' 334 4261461.0645 2661117.6797 3918916.0472'
' 352 4266205.852 2659683.96 3914798.2885'
' 404 4258400.8221 2662966.354 3920634.872'
' 414 4255211.3943 2666063.0462 3921735.7546'};
out1 = regexp(cellArray,'(?<=^\s*)\d*','match');
out1 = cat(1,out1{:});
cellArray2 ={' N334 4261461.0645 2661117.6797 3918916.0472'
' N352 4266205.852 2659683.96 3914798.2885'
' N404 4258400.8221 2662966.354 3920634.872'
' N414 4255211.3943 2666063.0462 3921735.7546'};
out2 = regexp(cellArray2,'N\d*','match');
out2 = cat(1,out2{:});

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by