フィルターのクリア

How to save a filename that is part user input and part text?

1 回表示 (過去 30 日間)
Anthony Nguyen
Anthony Nguyen 2012 年 10 月 16 日
I'm having trouble figuring out how to save a filename that is part user input and part variable?
For example:
a = input('Please enter a filename: ', 's');
x = 1+1;
y = 2-0;
save(a??, 'x', '-ASCII');
save(a??, 'y', '-ASCII');
Let's say user filename is math
I want to save two different ascii files with a similar name as math, but be able to distinguish the two.
for example, I want to save them as:
mathadd
mathsub
How would I go about doing this with the save function? Is it even possible? Thanks.

採用された回答

Honglei Chen
Honglei Chen 2012 年 10 月 16 日
save(sprintf('%sadd',a),'x','-ascii')

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by