# Create Table for Matlab Newtonian Cooling Solution

• MATLAB
• MechanicalMan
In summary: Hope that helps.In summary, you would first need to import the Excel file into MATLAB, using one of two methods. Once imported, you could use one of the MATLAB functions to address individual elements.
MechanicalMan
Hi all,

I'm writing a program for a graduate level course that I'm taking wherein I'm solving the Newtonian cooling solution for a long metal rod with specified properties.

I have no problem setting up the code and generating a plot, but I am running into problems creating a table of the results. The requirement for the assignment is to present the data in both tabular and graphical format.

If I'm dealing with, say, T(t) and t as dependent and independent variables, respectively, how do I go about creating a table, much like I could get from excel?

For example, I'm hoping for something such as:

T(t) t
50 1
40 2
30 3
etc..

Your variables for T and t are array variables. Displaying them is a matter of looping through the pairs of values with a for loop, and displaying them with the fprintf function. Assuming your arrays have 50 elements, your code would look something like this.

Code:
% Print a header to standard output device
fprintf(1, "Temperature\t time\n")
% Loop through temperature and time arrays
for i = 1:50
fprintf(1, "%d\t%d\n", T(i), t(i))
end

The example data you showed consisted of integers, and I used conversion specifiers in the second fprintf call to accommodate integers. If your data is floating point, you will need different conversion specifiers. Here's a link to the fprintf documentation: http://www.mathworks.com/access/helpdesk/help/techdoc/ref/fprintf.html.

Hi,

I am trying to write MATLAB codes for an excel table (Bsically create a function). In the first column (header), there are some characteristics and in the first row, there are some experimental results for the characteristics. How can I do that to address each datium in a specific row and column?

Thanks

Welcome to PhysicsForums!

In the future, if you have a new topic, please post a new topic, rather than posting in someone else's post, especially one that's over a year old.

As for your specific question, are you asking how to import .xls (or .xlsx) files into MATLAB, or how to work with them once imported? If you're new to MATLAB, I highly suggest their Getting Started series, or their Tutorial series (e-mail registration is required for the Tutorial series, but not the Getting Started).

Tutorials:

Getting Started:
http://www.mathworks.com/help/techdoc/learn_matlab/bqr_2pl.html

Last edited by a moderator:
Thanks for your prompt response and sorry about replying here. I was wondering how I can import the excel file (the table) into the MATLAB?? Basically, I want to create a function to address each column and row.

Thanks again

Well, there are two ways of importing Excel data, without having to manually do things line by line or column by column. The first is via the data importer, which has a nice graphical user interface--GUI--to guide you through the process (type in uiimport at the MATLAB prompt):
http://www.mathworks.com/help/techdoc/ref/uiimport.html

The second is to use xlsread:
http://www.mathworks.com/help/techdoc/ref/f16-5702.html#f16-14631

You can find detailed information (including examples) on all MATLAB functions at the site I linked to. You can also find some basic information within the program by typing in help <NAME OF FUNCTION>. For instance, typing in the following will bring up a little blurb on the uiimport function:
>> help uiimport

Once you have it in MATLAB, you can address individual elements using the techniques here:
http://en.wikibooks.org/wiki/MATLAB_Programming/Introduction_to_array_operations

Still, the MATLAB tutorials / getting started guide I linked to in my previous post will get you up to speed fairly quickly if you're new to MATLAB.

Last edited by a moderator:

## 1. What is a "Create Table for Matlab Newtonian Cooling Solution"?

A "Create Table for Matlab Newtonian Cooling Solution" is a table that displays the data and results of a solution to the Newtonian Cooling problem using the software Matlab. It typically includes values for time, temperature, and other relevant variables.

## 2. How do I create a "Create Table for Matlab Newtonian Cooling Solution"?

To create a "Create Table for Matlab Newtonian Cooling Solution", you will need to first input your data and equations into Matlab. Then, you can use the "table" function in Matlab to organize and display your data in a table format.

## 3. Can I customize the appearance of my "Create Table for Matlab Newtonian Cooling Solution"?

Yes, you can customize the appearance of your table by adjusting the formatting options in Matlab. This includes changing the font, color, and size of the table, as well as adding titles and labels to the rows and columns.

## 4. How accurate is the data in a "Create Table for Matlab Newtonian Cooling Solution"?

The accuracy of the data in a "Create Table for Matlab Newtonian Cooling Solution" depends on the accuracy of the input data and equations. Matlab is a reliable software for solving mathematical problems, so if the input data and equations are accurate, the results in the table should also be accurate.

## 5. What is the purpose of a "Create Table for Matlab Newtonian Cooling Solution"?

The purpose of a "Create Table for Matlab Newtonian Cooling Solution" is to visually represent the data and results of a solution to the Newtonian Cooling problem. It allows for easy analysis and comparison of the data, making it a useful tool for scientists and engineers.

• MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
• MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
• MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
• MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
• MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
• MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
• MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
17K
• MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
969
• MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
• MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K