フィルターのクリア

Clearing rows in dataset arrays

2 ビュー (過去 30 日間)
Adam Clark
Adam Clark 2012 年 5 月 29 日
I am working with nx5 heterogeneous dataset arrays imported from Excel which has some rows containing empty cells. Normally when I work with cell arrays I can eliminate these excess rows by using:
A(strcmp(A, '' ))=[];
When I try this and other variants I get an error stating 'Dataset array subscripts must be two-dimensional'. I have tried other variations using functions such as datasetfun() with no luck. If any one has any thoughts or suggestions I would really appreciate it.
Thanks, Adam

採用された回答

Tom Lane
Tom Lane 2012 年 5 月 30 日
That's because you can't delete individual "cells" from a dataset array. You need to delete entire rows. (Besides that, strcmp won't work as you want on a dataset.) For example, you could do this to delete rows where Var1 is an empty string:
A(strcmp(A.Var1,''),:) = [];
I can't think of a simple way to do this for all columns except by looping over them.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by