Table won't show up when I publish
2 views (last 30 days)
Show older comments
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 Comment
Sindar
on 18 Feb 2020
Where do you define the bmi function in your script? That seems to be the issue
Answers (1)
Sai Sri Pathuri
on 26 Feb 2020
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
0 Comments
See Also
Categories
Find more on Model and Validate Requirements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!