How do string with quotes
13 ビュー (過去 30 日間)
古いコメントを表示
Hello, I wanted to ask two questions when creating a character string to process a function in matlab. I want to do the following (which is to extract an audio wav youtube URL); where I created and saved in the directory wav youtube with the id of the shape e4d0LOuP4Uw.wav
system ( 'youtube-dl -x --audio-format wav --id https://www.youtube.com/watch?v=e4d0LOuP4Uw');
Well but that string the address is an input parameter that reads the URL of youtube after performing the above command is:
youtube_id = https: //www.youtube.com/watch?v = e4d0LOuP4Uw
then I want you, I read that parameter youtube_id but in quotation marks and do not know how to do ...
system ( "sudo youtube-dl -x --audio-format wav --id 'youtube_id);
How do I enter the input parameter enters quotes?
The second question is, how can I upload or just call that file is saved me or I believe in the working directory or folder e4d0L0uP4Uw.wav for use later in the function?
Thanks in advanced!
3 件のコメント
回答 (1 件)
Image Analyst
2016 年 5 月 22 日
Perhaps this will help:
stringWithDoubleQuote = 'abc"def'
stringWithSingleQuote = 'abc''def'
singleQuote = 39; % ASCII for single quote
stringWithSingleQuote = sprintf('abc%cdef', singleQuote)
In command window:
stringWithDoubleQuote =
abc"def
stringWithSingleQuote =
abc'def
stringWithSingleQuote =
abc'def
3 件のコメント
Image Analyst
2016 年 5 月 23 日
You can do this:
command = sprintf('youtube-dl -x YouTube- --audio -format --id "%s"', youtube_url);
This makes up the command line string with the URL you passed in enclosed in double quotes, which is how I think the system() command wants it.
参考
カテゴリ
Help Center および File Exchange で Audio and Video Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!