Info

この質問は閉じられています。 編集または回答するには再度開いてください。

input with structures

1 回表示 (過去 30 日間)
Özgür Karagülle
Özgür Karagülle 2012 年 5 月 17 日
回答済み: Voss 2021 年 12 月 31 日
Domain.x='xxxxx'; Domain.y='18 May 2012'; Domain.z='zzz'; Domain.t='tttttt';
Hi, i know how i make structure like up. But i dont know how i can use input function and take "x","y","z","t" variables from users with my GUI ?

回答 (1 件)

Voss
Voss 2021 年 12 月 31 日
I don't know what your GUI does, but here's one way to do it using the input() function:
f = {'x' 'y' 'z' 't'};
args = [f; cellfun(@(x)input(sprintf('Enter %s: ',x),'s'),f,'UniformOutput',false)];
Domain = struct(args{:});

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by