MATLAB Answers

User inputs for publish

12 views (last 30 days)
vinay kumar
vinay kumar on 15 Jan 2021
Answered: Steven Lord on 15 Jan 2021
do we have any command for successfull execuation of the publish for the user inputs, when i try to execuate and publish the code with input function it pop up an error as
Error using input Cannot call INPUT from EVALC. Error in act2 (line 20) line = input("select the line which you want to calculate, 1 for twowire, 2 for coaxial, 3 for parallelplate")

  0 Comments

Sign in to comment.

Answers (1)

Steven Lord
Steven Lord on 15 Jan 2021
To me, publishing is intended as a non-interactive activity. You should be able to start the publishing process, go get a cup of your favorite beverage, and come back to find the publishing process complete.
Calling input is absolutely an interactive activity.
I would extract the interactive section of your code that calls input into an interface function and turn the computational section of your code into a computational function that accepts data either from the interface function or directly from the user calling it. Then call publish with the 'codeToEvaluate' name-value pair argument containing a call to your computational function with the appropriate inputs. If you want to have a user interact with the computational function they could do so directly or they could call your interface function.
If you're publishing via the Toolstrip rather than executing the publish function, click the downward pointing triangle under the Publish icon on the Publish tab of the Toolstrip in the Editor. You can specify the code you want to run when you publish.

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!