mkdir give me a error

14 ビュー (過去 30 日間)
haolin yang
haolin yang 2018 年 2 月 13 日
コメント済み: Walter Roberson 2018 年 2 月 13 日
can someone help me on this and fix it?
for i = 1:N
mkdir(magnitude, serialName{1,i});
end
the error shows as :
Error using mkdir
Argument must contain a string.

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 2 月 13 日
The two-element form of mkdir() requires that the first input is an ftp session (possibly an ssh session) and that the second element is a character vector.
I suspect what you want is
mkdir( fullfile(magnitude, serialName{1,i}) )
but possibly you want
mkdir( sprintf('%.3f%s', magnitude, serialName{1,i}) )
depending on if magnitude is numeric and if so then how many digits you want used from it.
  2 件のコメント
haolin yang
haolin yang 2018 年 2 月 13 日
if I use "sprintf" give me a error "Function is not defined for 'cell' inputs."
Walter Roberson
Walter Roberson 2018 年 2 月 13 日
That suggests that either magnitude or serialName{1,i} are cells.
You have not been clear about what data types you are using, and you have not been clear about what the desired resulting name is. An example would be useful.

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

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by