[如何在MATLAB中绘制由多个行和一列组成的单元格中的数据? [关闭]

问题描述 投票:-1回答:1

我编写了一个MATLAB程序,在其中我通过读取文本文件提取了一个单元格数组,现在我必须根据其行号映射此单元格数组的内容。我的问题如下:在MATLAB中,如何在由多行和一列组成的单元格中绘制数据?谢谢

matlab matplotlib plot matlab-figure cell-array
1个回答
0
投票

以下一些资源可能对您有帮助:

2-D line plot:绘图工具可以获取数据X和Y的数组,并输出2D绘图。您也可以只给它一个输入,它将按行号均匀地绘制它。

Matrix indexing:这可能有助于格式化绘图工具的数据。例如,如果只需要一个名为X的100x4矩阵的第一列(100行,4列),则可以使用X(:,1)对其进行索引。


这是编辑后绘制数据的代码:

data2 = [2.4392E-09; 2.6506E-09; 3.0690E-09; 4.0424E-09; 7.1719E-09; 1.8084E-08; 6.0006E-08; 2.1621E-07; 7.7861E-07; 2.6695E-06; 8.4323E-06; 2.3340E-05; 5.1783E-05; 1.1155E-04; 2.6871E-04; 3.4549E-04; 2.6871E-04; 1.1155E-04; 5.1783E-05; 2.3340E-05; 8.4323E-06; 2.6695E-06; 7.7861E-07; 2.1621E-07; 6.0006E-08; 1.8084E-08; 7.1719E-09; 4.0424E-09; 3.0690E-09; 2.6506E-09; 2.4392E-09];
% Plot this data
plot(data2)
title("Logarithmic plot of Shirin's data")
% Set the axis type to logarithmic so the data is better portrayed
set(gca, 'YScale', 'log')
ylabel('Magnitude of data points')
xlabel('31 points, evenly spaced')

Here's an image of the result

如果这对您有所帮助,请考虑选择我的答案正确无误:)

© www.soinside.com 2019 - 2024. All rights reserved.