Output does not get published, error using evalin shows

Every time I try to publish in pdf or doc, only the codes get published. The outputs from the command window do not get published and instead this error message shows up.
Error using evalin
Undefined function 'homework' for input arguments of type 'char'.
These are the codes:
%%Problem 4
% code for problem 4
r=rand(5,4);
m = [4.000 + (25.000-4.000).*r]
m1=max(max(m))
m2=min(min(m))
s1=sum(m)
s2 = sum(m,2)
The name of the file is homework 2

 採用された回答

Stephen23
Stephen23 2018 年 9 月 4 日
編集済み: Stephen23 2018 年 9 月 4 日

0 投票

There seems to be a problem with the name: in MATLAB, function and script names are not permitted to have space characters in them. Instead of this "homework 2.m" (which has a space), you need to use "homework2.m" or "homework_2.m".
The permitted characters for function and script names is explained in the MATLAB documentation:

2 件のコメント

Monika Nayar Ali
Monika Nayar Ali 2018 年 9 月 4 日
Thank you so much for your answer, it worked this time. If I want to publish a graph, do I have to separately include it or would it show up in the published file directly?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by