绘制图的痕迹

时间:2016-09-10 11:04:38

标签: matlab plot binary matlab-figure

我有11个二进制数据集,我想生成一个图表,其中包含数据集(所有297x258)的相应数字的轨迹,y轴和x轴乘以(1.3 * 10)的比例^( - 6))并分别标记为“Y轴(μm)”和“X轴(μm)”。 11个数据集存储在一个单元格中(即public MainWindow() { InitializeComponent(); Teams = TeamsData.Teams; var appData = Application.UserAppDataRegistry; object nameRegistry = null; object ipRegistry = null; object teamRegistry = null; if (appData != null) { nameRegistry = appData.GetValue(NameRegistry); ipRegistry = appData.GetValue(IpRegistry); teamRegistry = appData.GetValue(TeamRegistry); } PlayerName = nameRegistry?.ToString() ?? "Player Name"; IpAddress = ipRegistry?.ToString() ?? "localhost"; PlayerTeam = teamRegistry?.ToString() ?? Teams.Keys.First(); NameBox.Text = PlayerName; AddressBox.Text = IpAddress; TeamsDropdown.SelectedItem = Teams[PlayerTeam]; } ,... data1{1})。此外,如果绘图还可以使用相应数据集的名称标记每个跟踪,则可以理解(即data1{11})。

The binary data

预期输出的一个例子: expected output

1 个答案:

答案 0 :(得分:1)

要绘制此图,我首先在所有数据集的每列中找到第一个非零元素,然后将它们相加以绘制彼此叠加的线。
最后,我将轴乘以您给出的转换常数(下面为raitio)并更改格式以符合您要求的样式:

data = reshape(cell2mat(data1),297,258,[]);
S = size(data);
fnzc = zeros(S([1 3])); % first non zero in column
for k = 1:S(3)
    csc = cumsum(data(:,:,k)>0,2); % on columns
    fnzc(:,k) = csc(:,end);
end
ratio = 1.3*(10^(-6));
ax = axes;
plot(ax,(S(1):-1:1)*ratio,cumsum(fnzc,2)*ratio)
ax.XAxis.TickLabelFormat = '%2d';
ax.XAxis.Exponent = -6;
ax.YAxis.TickLabelFormat = '%2d';
ax.YAxis.Exponent = -6;

结果是:

trace figure