フィルターのクリア

How to delete string in cell arrays?

4 ビュー (過去 30 日間)
Sonisa
Sonisa 2016 年 2 月 25 日
I want to delete this strings in a cell arrays and this strings appeared at 590 columns, sometime in 609 column. I tried this. It worked but it doesn't delete anything. Thanks in advance for helping.
c = {'Time','DOY','VWC05','VWC10','VWC20','VWC50','T05','T10','T20','T50','PAW40','PAW65';'#','#','cm^3/cm^3','cm^3/cm^3','cm^3/cm^3','cm^3/cm^3','°C','°C','°C','°C','mm','mm'}% cell array of strings
row_to_delete = all( cellfun(@(c) ischar(c) && strcmp(c,'Time'), SMdate), 1);
SMdate(row_to_delete, :) = [];
  3 件のコメント
Sonisa
Sonisa 2016 年 2 月 25 日
Thank you so much Walter for your response. I finally figured out by using strcmp function.
Muhammad Usman Saleem
Muhammad Usman Saleem 2016 年 2 月 26 日
@Sonisa if you find solution of your question then please accept answer of @walter for reward of assistance

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2016 年 2 月 25 日
You have all(..., 1) which applies the all() by column. The result would be a logical row vector, 1 by number of columns. But you then use that logical vector as a row index instead of as a column index.

その他の回答 (1 件)

Muhammad Usman Saleem
Muhammad Usman Saleem 2016 年 2 月 25 日

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by