Call file names one by one from an array

2 ビュー (過去 30 日間)
Damith
Damith 2015 年 3 月 25 日
コメント済み: Damith 2015 年 3 月 26 日
Hi,
I have the "d" array (31x1 struct) which has file names.
When I do the following in the command prompt:
>> d.name
list all the names stored in d array
Is there a way to call one name at a time since I am planning to use a for loop
For example:
for i=1:length(d)
input_file=[d.name];
end

採用された回答

per isakson
per isakson 2015 年 3 月 25 日
編集済み: per isakson 2015 年 3 月 25 日
"one name at a time" &nbsp Replace
input_file=[d.name];
by
input_file = d(i).name;
  1 件のコメント
Damith
Damith 2015 年 3 月 25 日
Thanks.

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

その他の回答 (2 件)

the cyclist
the cyclist 2015 年 3 月 25 日
d(1).name
will the name field of the first struct.
  1 件のコメント
Damith
Damith 2015 年 3 月 25 日
Thanks

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


Konstantinos Sofos
Konstantinos Sofos 2015 年 3 月 25 日
Hi,
By d.name you call all names,instead use d(idx).name to call the required filename
for idx=1:length(d)
input_file=d(idx).name;
end
  1 件のコメント
Damith
Damith 2015 年 3 月 26 日
Thanks

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by