Info
この質問は閉じられています。 編集または回答するには再度開いてください。
How to declare a variable that contains both string and a variable which has been previously declared?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I'm having a tough time trying to declare a variable that contains both text and another variable. So, here's my situation:
Prompt1='Please enter the date';
1st variable: ReadDate=input('Prompt1',s); %I input the date as 1Sep
2nd variable: inFile='CTD_',num2str(ReadDate),'_GMT.dfs0';
The resulting inFile only displays CTD_ but not the full CTD_1Sep_GMT.dfs0
Please guide me on this.
Thanks!!
0 件のコメント
回答 (1 件)
Image Analyst
2015 年 11 月 13 日
I think the best way to create and use a "variable that contains both text and another variable" is to create a structure
myStruct.string = someStringVariable;
myStruct.var = someNumericalVariable;
You can call the fields almost anything you want - any legal variable name.
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!