필터 지우기
필터 지우기

How do you get matlab to import/read a column vector of strings or characters??

조회 수: 1 (최근 30일)
How do you get matlab to import a column vector of strings or characters??
[zone]=xlsread('Tox_model.xlsx',2,"E5:E10");
E5-E10 reads like this in excel:
s1
s2
s3
s2
s3
s1
In reality the colum vector is very long (1000s) and not just a (1:5) vector ...
The variable is empty when I run the code. Why???

채택된 답변

David Hill
David Hill 2021년 1월 27일
Did you try reading into a cell array?
zone=readcell('Tox_model.xlsx');
  댓글 수: 5
David Hill
David Hill 2021년 1월 28일
m=readmatrix('Tox_model.xlsx','Sheet','PWS PFHxS Conc','Range','D5:L102');%much easier to read into a matrix and use indexing
a=readcell('Tox_model.xlsx','Sheet','Participants'' water intake ','Range','E5:E102');
k={'s1','s2','s3','w1','w23','w4','w5','f1','f2','sh'}
for n=1:length(a)
WatCon(n)=m(n,ismember(k,a(n)));%there are several 's0','s5','s4' listed in array that do not correspond
end

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

추가 답변 (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