Make name in for loop and read table

3 ビュー (過去 30 日間)
Dion Theunissen
Dion Theunissen 2021 年 6 月 28 日
回答済み: Jeff Miller 2021 年 6 月 29 日
Hi,
How can I make this working? now i got the error "Dot indexing is not supported for variables of this type."
I want to use that name and open the table of the name i created.
for p = 1:7
Name = strcat('ScanRec',num2str(p))
vins1 = unique(Name.vin);
end
  1 件のコメント
Stephen
Stephen 2021 年 6 月 28 日

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

回答 (1 件)

Jeff Miller
Jeff Miller 2021 年 6 月 29 日
I guess you have tables called ScanRec1, ScanRec2, ...? If so, you can do almost what you want by making each table a field within a structure S, something like this:
S.ScanRec1 = table(vin,whatever);
S.ScanRec2 = table(vin,whatever);
% and so on
Then your for loop would be something like this:
for p = 1:7
Name = strcat('ScanRec',num2str(p))
vins1 = unique(S.(Name).vin);
end

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by