필터 지우기
필터 지우기

Indexing between numerical and cell arrays

조회 수: 1 (최근 30일)
Ben
Ben 2022년 10월 12일
댓글: dpb 2022년 10월 12일
Hi,
I have the below three variables that originally come from numerical and raw outputs from reading a spreadsheet using the xlsread function. The third variable ('NumcCrop") is a subset of "Numc" that was created by removing rows where selected columns had NaN values. I would like to truncate the first variable ("SubRaw") in the same way so that I can extract the names from column two relating to the subset identified in the third variables.
I can't simply remove the rows in the same way as I did to create ('NumcCrop") as the 'raw' output when reading the file only has NaNs for empty cells, whereas the "Numc" variable has NaNs for all non-numerical elements.
It seems like something that should have a simple solution but I have been running into issues with incorrect or inconistent data types when trying to convert the cell arrays into something where they can be indexed or concatenated together. I've tried various cellfun methods including find and ismember but none seem to work.
Thanks a lot!
  댓글 수: 4
Stephen23
Stephen23 2022년 10월 12일
@Ben: please upload a sample data file by clicking the paperclip button.
Most likely you should be using READTABLE et al.
dpb
dpb 2022년 10월 12일
"...originally come from numerical and raw outputs from reading a spreadsheet using the xlsread function."
And, as @Stephen23 notes, there's the root of all your trouble--using the deprecated xlsread function instead of readtable

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by