hello everyone! I need to extract some data out of my table and I am facing the following problem. can anyone help?
3 次查看(过去 30 天)
显示 更早的评论
I have a variable named F1 which is 100*1 structure table.
there is a column named Position which is 100*3 structured data.
I need to take each of Position data out and also seperate them like 100*1 columns 3 times seperately in 3 diffrent variables.
I wrote like this :
>> F1.Position(:,1)
Expected one output from a curly brace or dot indexing expression, but there were 100 results.
How can I extract the data of each column of position in diffrent variables such as f1,f2,f3?
采纳的回答
Ameer Hamza
2020-6-1
Try this
Pos = vertcat(F1.Position);
f1 = Pos(:,1);
f2 = Pos(:,2);
f3 = Pos(:,3);
16 个评论
Amir Hosseini
2020-6-1
yet I have a 100*2 structured table and want to get them out and put them in f1 and f2 .
I tried your way and faced with:
Scalar structure required for this assignment.
how can I do this?
Amir Hosseini
2020-6-1
and also the syntax 'vertcat' extract datas in matrix consecutively for example if you have a table like:
[2,5]
[3,4]
and if you use vertcat it will return : 2,5,3,5
but I want the datas to be extracted like this:
f1=2,3;
f2=5,4;
how is that possible?
Amir Hosseini
2020-6-2
[0.0989692320462818;0.0380338174108045]
[0.166633464070839;0.0134213477997109]
[0.161200312887973;0.0138461869991238]
[0.153443460408892;0.0143052012616811]
[0.164982926654386;0.0136830709675170]
[0.115237971942459;0.0213177824268041]
[0.102907563573464;0.0287721993300747]
[0.113109426702827;0.0222057510332509]
[0.103946746065240;0.0276779273804114]
[0.155926303469190;0.0140729676720983]
[0.149975388392833;0.0144781071636449]
[0.107638747065077;0.0249637609447715]
[0.106500549711984;0.0257149027974741]
[0.157948743116842;0.0138960434157176]
[0.130784450260867;0.0171763927621852]
[0.105322375056942;0.0266012611662013]
[0.0990812555038083;0.0363233226002100]
[0.106110599614453;0.0259967288598662]
[0.0989909854368261;0.0371987879890108]
[0.101360226461285;0.0308612858056531]
[0.118506500303254;0.0201429624739350]
[0.132388875298611;0.0168511001191042]
[0.102450769612389;0.0291933220004718]
[0.133985359516523;0.0166074329622439]
[0.100802887899219;0.0315318309428867]
[0.104842921786093;0.0269159585362235]
[0.136784406838918;0.0161375073272330]
[0.138119689354693;0.0159413896698064]
[0.104304615129131;0.0273796003288317]
[0.126942724270098;0.0179842224022383]
[0.124258887351137;0.0185543650150072]
[0.147696130626476;0.0147970448366054]
[0.128188169471293;0.0177041555263069]
[0.117776634122285;0.0204593367331682]
[0.135078297611775;0.0163964959679523]
[0.144975333221323;0.0150354084465430]
[0.102058914677034;0.0296390060797587]
[0.115914420484946;0.0211443650514049]
[0.120745374766452;0.0194518507691622]
[0.123304157967065;0.0188402559476738]
[0.149008828658516;0.0146275062147051]
[0.0996977346707718;0.0337246510547716]
[0.157505147264899;0.0139414198793767]
[0.119950499618293;0.0197726372395128]
[0.122702035543984;0.0189381779682561]
[0.116593849212972;0.0208369232638886]
[0.119503063785228;0.0199035161484877]
[0.138940413949468;0.0157973269344696]
[0.146853492232162;0.0148909915085427]
[0.135926539749975;0.0162701977020398]
[0.122132549402184;0.0193159258515512]
[0.0993395656645898;0.0349489666205588]
[0.143516951001271;0.0151655063436216]
[0.129713556337188;0.0173086886729408]
[0.0992494680429254;0.0354749171693054]
[0.0989740545131481;0.0375900435184156]
[0.0999194185162905;0.0331778943991734]
[0.100446627194077;0.0320831868740326]
[0.145671219804596;0.0149462474797292]
[0.132702004231866;0.0166948304533505]
[0.111819661063233;0.0227294054825921]
[0.108078352514797;0.0246924828838378]
[0.117118320634919;0.0206837374844714]
[0.110655122572765;0.0233500821980453]
[0.0994056386116763;0.0346621980500922]
[0.110044356677001;0.0235845040357031]
[0.142241203779386;0.0153051045777455]
[0.101829539742570;0.0299531094360372]
[0.0995347662740014;0.0342144630448737]
[0.109270448983447;0.0241151767301106]
[0.141444708973095;0.0154084095328591]
[0.112319587367747;0.0225096432912893]
[0.125726723940649;0.0182407753723983]
[0.101434905611909;0.0304686534865674]
[0.139783810329732;0.0156536065586475]
[0.126231457553038;0.0180741930190684]
[0.111344569606632;0.0229709277441846]
[0.100610879232062;0.0317433810077274]
[0.101620232203826;0.0302375726411312]
[0.100014843021049;0.0330004557011892]
[0.100244823709305;0.0324435794788881]
[0.100151973189375;0.0326189532230736]
[0.121485430240134;0.0193687845522816]
[0.129352445827661;0.0175147467997087]
[0.111168194471211;0.0231860328601603]
[0.108743005565936;0.0243265387764165]
[0.0991344624301883;0.0359077354430557]
[0.128645033123238;0.0175571149954534]
[0.108552973871536;0.0244819158088785]
[0.143266368513920;0.0152741202839653]
[0.112846878719138;0.0223746773060769]
[0.140767143812245;0.0155142546879509]
[0.0996202454025665;0.0339821352525846]
[0.149600371299210;0.0145664637800796]
[0.140300634552730;0.0155811386565620]
[0.124937495092273;0.0183859449149043]
[0.0991662083388951;0.0357398743079046]
[0.109561485465686;0.0238751084781327]
[0.109843427850346;0.0238563149558989]
[0.125043010928473;0.0183640857079355]
Amir Hosseini
2020-6-2
they are available in a column F1.Cost and as you see it is 100*2 and I want to have
f1=first columns(:,1)
f2=second columns(:,2)
Ameer Hamza
2020-6-2
Pasting the values does not help suggest a solution. I recommend attaching the struct variable as a .mat file.
Amir Hosseini
2020-6-2
since I couldn't attach the table as a .mat file I just copied the values in a column
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)