Table won't show up when I publish

조회 수: 3 (최근 30일)
JULIA ERICKSON
JULIA ERICKSON 2020년 2월 18일
답변: Sai Sri Pathuri 2020년 2월 26일
I have created a function and a separate script to run the function with my data, and format it into a table. When i click run in the script, it shows up in the command window as the pefect table that I need but then for some reason when i go to publish it, the table doesnt show up in my published pdf. What am I doing wrong ??? Attached are photos of my function, script, desired table, and what it shows when i publish
The Function is:
function bodymassindex=bmi(weight,height)
h=height./39.37;
w=weight./2.2046;
BMI=w./h.^2;
bodymassindex(BMI<=18.5)="underweight";
bodymassindex(BMI>18.5 & BMI<=25)="normal";
bodymassindex(BMI>25 & BMI<=30)="overweight";
bodymassindex(BMI>30)="obese";
end
The Script is:
W=80+170*rand(1,20);
H=50+35*rand(1,20);
result=bmi(W,H);
table=[num2str(W'),num2str(H'),result'];
array2table(table,"VariableNames",{'Weight in Pounds','Height in Inches','You Are'})
and my published script is displaying:
.
  댓글 수: 1
Sindar
Sindar 2020년 2월 18일
Where do you define the bmi function in your script? That seems to be the issue

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

답변 (1개)

Sai Sri Pathuri
Sai Sri Pathuri 2020년 2월 26일
I didn’t face any issue while running the script and publishing it. However, the following steps might help you.
Update the function and file system path caches using below command
rehash toolboxcache
Make sure that the script and bmi function are in the same folder before running the code and publishing.
You may refer following link for rehash function

Community Treasure Hunt

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

Start Hunting!

Translated by