Open data in File as per user input

2 ビュー (過去 30 日間)
Mihir
Mihir 2024 年 10 月 1 日
回答済み: Walter Roberson 2024 年 10 月 2 日
Hello, I am trying to get input from user to load a file and then ask which variable from the file would they like to plot. The input file will be a .mat file and it is a 1x1 struct file with various 2 double series data in it.
When I run this, the error says: Unrecognized field name "x"
Here is my code:
filename=input('Input File Name \n','s');
file = load(filename);
x=string(input('Variable? \n','s'));
plot(file.x)

採用された回答

Walter Roberson
Walter Roberson 2024 年 10 月 2 日
plot(file.(x))

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by