フィルターのクリア

Access data in table - how to chose a range of columns indexed by cell

3 ビュー (過去 30 日間)
turquoise_squid
turquoise_squid 2017 年 1 月 5 日
回答済み: turquoise_squid 2017 年 1 月 6 日
Is it possible in Matlab to select a range (not single) of columns in a table indexed by cells and not integers?
I was thinking something like table(:,{'varname1'} : {varname2})

採用された回答

Greg
Greg 2017 年 1 月 5 日
See the documentation. "Index Using a Logical Expression" section of the following page:
https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-table.html#zmw57dd0e25752
I'll take a swing that what you really want is all columns between varname1 and varname2 (whether inclusive or not). Your best be in that case is to do some string matching to turn varname1 and varname2 into column indices, then use the colon operator in the indexing expression.

その他の回答 (1 件)

turquoise_squid
turquoise_squid 2017 年 1 月 6 日
So yeah, what I usually do is this
% cellfind = @(string)(@(cell_contents)(strcmp(string,cell_contents))); % logical_cells = cellfun(cellfind('this is string'),vars.Properties.VariableNames)
I find this complicated though :)
thought there would be an easier way.

カテゴリ

Help Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by