Format COMPACT not working

I was running a script and everything was in the compact format but I wanted to put format compact into the script so i could run the script anywhere and it would make sure it output answers in the compact format. As soon as I ran it with the new line "format compact" everything went to the loose format. I restarted matlab, opened a new file, restarted my computer, and deleted the format compact line. I changed my preferences to compact format but as soon as I run my script everything goes back to loose again. My script is literally like 30 lines and i only have one line in the entire thing that says format "......." it is the format compact line. No other lines say format anything. I cannot find an answer to this anywhere I am getting quite frustrated. I hope its just something dumb please help!

7 件のコメント

David Goodmanson
David Goodmanson 2020 年 1 月 11 日
Hi Joshua, what happens with format('compact') ?
Joshua Kreider
Joshua Kreider 2020 年 1 月 11 日
Still Nothing it runs as if nothing was there
John D'Errico
John D'Errico 2020 年 1 月 12 日
編集済み: John D'Errico 2020 年 1 月 12 日
Are you sure that your script does not call some other function of yours, that resets the format? We cannot see your script, so this is something we cannot know.
Joshua Kreider
Joshua Kreider 2020 年 1 月 12 日
This is my entire script as it is now. I know I need to fix the third grouping for "problem5" but the format is the problem here
tic
clear
clc
format compact
syms a b
problem1=((2/3)*exp(-a/2)*cos(b-1));
answer=subs(problem1,[a,b],[-0.23,2.7]);
answerproblem1a=double(answer)
syms c d
problem3=[c*d+1;c-2*d];
answer=subs(problem3,[c,d],[1.54,2.28]);
format
answerproblem3a=answer
syms e
problem5=(exp((-3*e)/(5))+(e*log(e+1)));
answer=subs(problem5,[e],[4.4]);
answerproblem5a=double(answer)
a=-0.23;
b=2.7;
c=1.54;
d=2.28;
e=4.4;
answerproblem1b=((2/3)*exp(-a/2)*cos(b-1))
answerproblem3b={c*d+1;c-2*d}
syms f(e)
f(e)=(exp((-3*e)/(5))+(e*log(e+1)));
df = diff(f,e);
df2 = df(2);
answerproblem5b=double(df2)
toc
Joshua Kreider
Joshua Kreider 2020 年 1 月 12 日
I feel so stupid guys I am so sorry. I had format written and i truly did not even see it. I kept skimming right over that part I apologize.
John D'Errico
John D'Errico 2020 年 1 月 12 日
Yep. Been there, done that.
Joshua Kreider
Joshua Kreider 2020 年 1 月 12 日
Yes haha. Really appreciate the help though

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeFunction Creation についてさらに検索

製品

リリース

R2019a

質問済み:

2020 年 1 月 11 日

コメント済み:

2020 年 1 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by