필터 지우기
필터 지우기

MATLAB GUI calling external function

조회 수: 4 (최근 30일)
Jason Chang
Jason Chang 2022년 5월 11일
답변: Geoff Hayes 2022년 5월 12일
Hey,
For my senior project my task was to create a program that takes in user voice, and recognizes the frequency and returns the fundemental frequency of the voice. I have that task completed, but I wanted to implement that into a matlab GUI. I'm having trouble getting the GUI to read the external function. The external function that does the analysis originally took in user input to specify things such as recording length, and whether to return the exact pitch or the closest musical note ("corrected"). thanks for your help!
  댓글 수: 1
Matt J
Matt J 2022년 5월 11일
편집: Matt J 2022년 5월 11일
What is the "external function" in this case? Is it appsynthesizertestcode.m ?
How should your app be used so as to witness the problem you mention?

댓글을 달려면 로그인하십시오.

답변 (1개)

Geoff Hayes
Geoff Hayes 2022년 5월 12일
@Jason Chang - you will need to change the signature for your appsynthesizertestcode function so that you can pass in the parameters that you had been requesting before (via @doc:input). So perhaps something like
function appsynthesizertestcode(mode, recording_type, rec_length)
And you would call this function from your app as
% Value changed function: StartButton
function StartButtonValueChanged(app, event)
appsynthesizertestcode(app.ModeDropDown.Value, app.TypeDropDown.Value, app.recordlength.Value);
end
Note that the above will pass in strings for the mode and recording_type. Your appsynthesizertestcode function expects these to be integers so you will need to convert them from the string to the integer either before you pass them to the function or from within the function itself.
Also, you can remove calls to the app from within your function since it won't know about the app (unless you pass it in as a parameter).

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by