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 Center および File ExchangeShifting and Sorting Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by