using function input to create a title

Hello, I am currently writing a function which takes an input, creates a structure based on the size of the input, and sends it to a dot file.
My problem is that i want the dot file to be saved as different things based on the input. ie if I input function(5) i want the five to be incorporated into the name of the outgoing dot file.
incToDot(inc,8.0,8.0,1.0,'nameoffile.dot');
i would really like the output of file to be nameoffile#.dot where # is the size of the input value for the function. I am confused on how to do and any help would be great.

 採用された回答

Matt Fig
Matt Fig 2011 年 5 月 30 日

0 投票

N = 5; % An integer to use in the string below...
str = sprintf('nameoffile%i.dot',N) % Make a string.
% Use the above for integer N to make your string, then use it:
incToDot(inc,8.0,8.0,1.0,str);

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by