필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Help using textread as a nested function.

조회 수: 2 (최근 30일)
Richard
Richard 2011년 4월 28일
마감: MATLAB Answer Bot 2021년 8월 20일
I am trying to create a program that will play a song from a three column ASCII file. To do this I am using the textread function because there is a large amount of non-numerical data. I have setup my textread function properly because if I just run it by itself from the command line it creates the desired output. I want to know how I can setup a function that let's the user input the filename of the the song and then have my textread function run using the filename the user entered. I believe it's just a matter of setting my input properly to read a ('filename.txt'). Thank you for any advice you can offer, has been quite frustrating.

답변 (1개)

Markus
Markus 2011년 4월 28일
Is this what you want to do?
filename = input('Enter song!', 's')
filename = [strResponse '.txt']
Then you add the textread function:
A=textread(filename, ...)
  댓글 수: 3
Chirag Gupta
Chirag Gupta 2011년 4월 28일
on a side note, its better to use textscan than textread according to the documentation
Richard
Richard 2011년 4월 29일
Thank you Markus, this is essentially what I want to do, but how do I incorporate the filename = input('Enter song!', 's') into a function? I need it to take the entered filename and hand it to the textread function and be done with it from there, I dont want the filename as my final output. Thanks again.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by