How to find out how many colums are in matrix?

1 回表示 (過去 30 日間)
hawk5577
hawk5577 2018 年 11 月 22 日
コメント済み: hawk5577 2018 年 11 月 22 日
[filename filepath]=uigetfile('*.xlsx','multiselect','on')
length(filename)
How to find out how many columns or length (what is better?) are in the matrix [filename]?
If I select 2 files (test0.xlsx and test1.xlsx) my ans = 2
If I select 1 file (test1.xlsx) my ans is 10, sth its wrong ;/
*I just want to do a script that will detect, maybe someone have good idea for that :)
if I have 1 selected file
something1
else I have 2 selected files
something2
end
Thanks for help

採用された回答

Bruno Luong
Bruno Luong 2018 年 11 月 22 日
if ischar(filename) % you select 1 file
something1
else % your filename is cell of char/string % I have 2 selected files
something2
end

その他の回答 (1 件)

Geoff Hayes
Geoff Hayes 2018 年 11 月 22 日
hawk5577 - use size to determine the dimensions in your matrix. Since you are interested in the number of columns, then
numFiles = size(filename, 2);
  1 件のコメント
hawk5577
hawk5577 2018 年 11 月 22 日
ans=10
I think it counts letters ;/

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

カテゴリ

Help Center および File ExchangeTime Series Objects についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by