필터 지우기
필터 지우기

How do we eliminated columns in excel file has negative values?

조회 수: 1 (최근 30일)
ahmed obaid
ahmed obaid 2017년 2월 8일
댓글: ahmed obaid 2017년 2월 9일
Dear experiences
i have a data which are stored in an excel file which is consist from thousands of columns, therefore in my data there are some columns completely contain negative values in random order in other words in columns which must be eliminate the complete values in these columns are negative and there is no positive values exist .. i'm thinking to check first value in every column if its negative then eliminate otherwise if >=0 then leave. as in the following image where i need to eliminated columns along with its columns labels..
i would glade thanks any one can find a way to do this process.

채택된 답변

Guillaume
Guillaume 2017년 2월 8일
To delete at once all the columns for which all the rows are negative:
yourmatrix(:, all(yourmatrix < 0)) = [];
  댓글 수: 5
Guillaume
Guillaume 2017년 2월 9일
yourtable(:, [false, all(yourtable{:, 2:end} < 0)] = [];
However, better would be to fix the import so that the row labels become row names in the table. To your readtable add the option , 'ReadRowNames', true
ahmed obaid
ahmed obaid 2017년 2월 9일
Very smart solution , thanks a lot

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by