Error when trying to Publish from m file

I am having trouble when trying to publish the code below when it is in a m file. Instead of the graph that I expect I get an error message:
Error using evalin Undefined function 'Problem' for input arguments of type 'char'
TempF = 32 : 3.6 : 93.2;
TempC = 5 / 9 * (TempF - 32);
rho = 5.5286 * 10.^-8 * TempC.^3 - 8.5016 * 10.^-6 * TempC.^2 + 6.5622 * 10.^-6 * TempC + 0.99987;
plot(TempC, rho)
xlabel('Temperature in Degrees Celcius')
ylabel('Density of Freshwater (g/cm^3)')

 채택된 답변

Wayne King
Wayne King 2013년 9월 30일
편집: Wayne King 2013년 9월 30일

0 개 추천

If I enter the following:
%%Water Density vs. Temperature
% This plots the density of freshwater as a function of the temperature
% in celsius.
TempF = 32 : 3.6 : 93.2;
TempC = 5 / 9 * (TempF - 32);
rho = 5.5286 * 10.^-8 * TempC.^3 - 8.5016 * 10.^-6 * TempC.^2 + 6.5622 * 10.^-6 * TempC + 0.99987;
plot(TempC, rho)
xlabel('Temperature in Degrees Celsius')
ylabel('Density of Freshwater (g/cm^3)')
in an M-file called temperature.m and then execute
>>publish temperature.m
or just:
>>publish('temperature')
I have no trouble publishing it.
If you are not actually referring to MATLAB's publish() functionality, but rather using the above as a function, then please be specific.

댓글 수: 2

David
David 2013년 9월 30일
I have no idea what I did or didn't do. I retyped it in a new m file and it published fine the second time. It didn't want to print from the published m file though. I ended up using control - p to just print the screen.
Thanks.
Kyle Kinsey
Kyle Kinsey 2017년 10월 29일
I know this question is 4 years old but, I just had this problem the actual answer is that the file name has a space in it re-save without it and it publishes fine.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Scripts에 대해 자세히 알아보기

태그

질문:

2013년 9월 30일

댓글:

2017년 10월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by