Hello ! I want to scatter an csv file with a colorbar (plot 3 parameters). Fro this purpose I ued this program :
figure
date=txt(:,1)
Q=date(2:end)
scatter(Q(:,1),num(:,1),12,num(:,16)),colorbar;
set(gca,'xticklabel',raw(1:length(raw),1))
set(gca,'yticklabel',raw(1:length(raw),2))
xlabel('Date');
ylabel('Latitude');
title ('Temp38');
what does'nt work with an error messg "Error using scatter (line 56) Input arguments must be numeric, datetime, duration or categorical." Because the format of the date is like :
  • 2016.03.01 14:39:00
  • The step of the date is one minute, but at some level , the date changes literally like from 2016.03.01 17:40:00 to 2016.03.15 16:43:00 (this is due to an assembly of several files but it does not make problem if there is a possibility to make a regular step)
Here is a photo to show the type of data I have (the rest of the data are numeric) :
And you can find attached the file I want to plot. Any Ideas? I will appreciate your help !

 採用された回答

KSSV
KSSV 2018 年 9 月 11 日

0 投票

T = readtable('1.xls') ;
x = T.(3) ; % longitude
y = T.(2) ; % latitude
c = T.(4) ;
scatter(x,y,10,c,'filled')
Follow the same with other variables.

4 件のコメント

Silver
Silver 2018 年 9 月 11 日
Thanks for answring but this not exactly what am looking for . I want a graphe with :
  • x axis = date
  • Y axis = latitude
  • colorbar = temperature (Temp38)And the problem here is the format of the dates, I have to convert them so I can put them in the scatter fonction.Any ideas ?
KSSV
KSSV 2018 年 9 月 11 日
Convert the dates to numbers using datenum.
Silver
Silver 2018 年 9 月 11 日
編集済み: Silver 2018 年 9 月 11 日
I've already used this code wich gave me the same value of conevrsion for all dates :/ , it does not solve the problem yet
date=txt(:,1) %dates are in the first column
x=date(2:end) % plot dates beginning from the second cell
time=datenum(x)
scatter(time,num(:,1),12,num(:,10)),colorbar;
datetick('x','yy/mm/dd HH:MM:SS','keeplimits','keepticks')
Silver
Silver 2018 年 10 月 28 日
Hey am back again x) ! I want to change the column names of the table , but when I use this code :
T.Properties.VariableNames = {'Date_Time' 'Latitude' 'Longitude' 'Course' 'Speed' 'Temp_SBE45' 'Cond_SBE45' 'SoundVel_SBE45' 'full' 'pH_SeaFET' 'Saturation' 'Salinity_SBE45' 'Temperature_Optode' 'flow_pCO2' 'pH_Meinsberg' 'Temp_in_SBE38' 'Temp_Meinsberg' 'Oxygen' 'pCO2' 'pressure' 'flow_in' 'flow_main' 'flow_pH' 'Turbidity' 'halffull' 'Chl_a' 'Variance' 'pH_Meinsberg' 'Variance' 'Temp_Meinsberg' 'Variance' 'pH_SeaFET' 'Variance' 'pCO2' 'Variance' 'pressure' 'Variance' 'flow_in' 'Variance' 'flow_main' 'Variance' 'flow_pH' 'Variance' 'flow_pCO2' 'Variance' 'halffull' 'Variance' 'full' 'Variance'}
I always get this error message, I dont understand where the problem lies, I even change the variable name but in vain :
Duplicate variable name: 'Temperature_Optode'.
Do you have any ideas ?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDiscrete Data Plots についてさらに検索

質問済み:

2018 年 9 月 11 日

コメント済み:

2018 年 10 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by