フィルターのクリア

Not really understanding why cdata isn't working

6 ビュー (過去 30 日間)
Stride Okorie
Stride Okorie 2022 年 7 月 27 日
回答済み: Walter Roberson 2022 年 7 月 27 日
This code I have is giving me an error saying cdata is not a recognizable function. If anyone could help me understand why, it would really be helpful please.
clc;
clear;
close all;
DataTbl=readtable('N303_M.2.csv');
[Ro,Co]=size(DataTbl);
Data=table2array(DataTbl);
latitude=Data(:,1);
longitude=Data(:,2);
altitude=Data(:,3);
h = heatmap(cdata,'ColorLevels', 5);
h.XLabel = 'Longitude';
h.YLabel = 'Latitude';

回答 (2 件)

Star Strider
Star Strider 2022 年 7 月 27 日
The ‘cdata’ matrix only exists if you create it.
See the heatmap documentation section Create Heatmap from Matrix Data for details, since that appears to be what you’re referring to.

Walter Roberson
Walter Roberson 2022 年 7 月 27 日
heatmap can be called in two different ways.
If you call it with a 2d numeric array, then a map is constructed that is the same size as the array and the array values are relative intensities. This is the mode that your code is trying to use.
If, however, you have a table() object, then you can pass in the table and the names of two variables, and heatmap() will count all of the times that each combination of the two variables occurs and will create a heatmap of the results. This might be the form that you actually need.

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by