Matlab - What does an array definition mean

In summary, the conversation discusses the use of plotyy in MATLAB to create a plot with two types of data, temperature and air flow rate, on different scales. The solution involved using handles, which are used to control properties of objects, to adjust the line width of the air flow rate. The user also learned about the concept of handles and their use in MATLAB.
  • #1
luitzen
49
0
I'm trying to make a MATLAB plot with two types of data, i.e. temperature and air flow rate. Since the temperature and air flow rate are on different scales I wanted two y-scales and since there are quite some data sets, I wanted to make the two air flow rates bold.

I tried this, but it doesn't work:

plotyy(time,reator_temperature_matrix,time,air_flow_matrix,'LineWidth',2)

After a long journey, I ended up here: http://www.mathworks.com/matlabcentral/newsreader/view_thread/81078

And saw it solved the following way:

[AX,H1,H2] = plotyy(time,reactor_temperature_matrix,time,air_flow_matrix) ;
set(H2,'LineWidth',2)

This solved my problem, though now I'm curious what [AX,H1,H2] means and I couldn't find it anywhere on the internet. What does '[AX,H1,H2] = ...' create? Can I choose any name for AX, H1 and H2?

When I go to the workspace, I see three vectors with some numbers, but they don't make any sense to me.
 
Physics news on Phys.org
  • #3
Thank you very much. When I have time I'll will try to read up on handles. My plots now look exactly the way I want them to look.
 

Related to Matlab - What does an array definition mean

1. What is an array in Matlab?

An array in Matlab is a collection of elements that are of the same data type and are stored in a contiguous memory location. It can store multiple values of the same or different data types in a single variable, making it a useful data structure for data manipulation and analysis.

2. How is an array defined in Matlab?

An array in Matlab is defined by using square brackets [ ] and separating each element with a comma (,). For example, [1, 2, 3] creates an array with three elements: 1, 2, and 3. It can also be defined using a range of values, such as 1:10, to create an array with values from 1 to 10.

3. What is the difference between a vector and a matrix in Matlab?

In Matlab, a vector is a one-dimensional array that can contain a single row or column of elements. A matrix, on the other hand, is a two-dimensional array that can contain multiple rows and columns of elements. This means that a vector has only one index, while a matrix has two indices (row and column) to access its elements.

4. Can an array contain elements of different data types in Matlab?

No, an array in Matlab can only contain elements of the same data type. This is because Matlab is a strongly typed language, meaning that the data type of a variable is defined and cannot be changed during execution. To store elements of different data types, a cell array must be used instead of a regular array.

5. How can I access specific elements in an array in Matlab?

To access specific elements in an array in Matlab, you can use indexing. Indexing is done by specifying the position of the element in the array using its row and column indices. For example, A(2,3) would access the element in the second row and third column of the array A. You can also use logical indexing to access elements based on certain conditions.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
748
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
18K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
21K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
8K
Back
Top