How do I publish results with an input command?

조회 수: 12 (최근 30일)
kevin nguyen
kevin nguyen 2015년 9월 9일
답변: San N 2020년 12월 16일
When I publish my code, I get an error saying there is no value for n. This is correct,so I'm wondering if there is a way to publish while saying n =8. I'm trying to make a random number column vector nx1 then sort it by descending values.
here is my code:
n=input(' enter an integer:');
v=randn(n,1)
w=sort(v,'descend')

채택된 답변

Hamoon
Hamoon 2015년 9월 9일
publish(file,'evalCode',false)
  댓글 수: 3
Hamoon
Hamoon 2015년 9월 9일
in the publish options.
Hamoon
Hamoon 2015년 9월 10일
save your script as mycode.m then execute this:
publish('myCode.m','evalCode',false)
As you know if your current folder is different from where you saved your script, you need to pass the full path of your script. eg.
publish('C:\work\myCode.m','evalCode',false)

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

추가 답변 (1개)

San N
San N 2020년 12월 16일
IF I want to publish the outputs after getting an input from user, how can I do it ?

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by