How do string with quotes
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Image Analyst
le 22 Mai 2016
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 commentaires
Image Analyst
le 23 Mai 2016
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.
Voir également
Catégories
En savoir plus sur Audio and Video Data dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!