How to curvefit data from a csv file?

15 ビュー (過去 30 日間)
Saurav Karmakar
Saurav Karmakar 2020 年 6 月 16 日
回答済み: John Miles 2021 年 3 月 29 日
I have a dataset of COVID in .csv file, how do I get curvefit GUI or the code to run for that? I want to get x-axis as 'Date' and y-axis as 'Confirmed'?

回答 (2 件)

Saurabh Kumar
Saurabh Kumar 2020 年 6 月 18 日
Hi Saurav,
You can import data from csv file using readmatrix into a matrix form in MATLAB. Select the column from the matrix and use cftool app to generate the curve as shown below.
data =readmatrix('covid.csv'); %assuming csv file name to be 'covid.csv'
date=data(:2); %assuming date is present in second column
confirmed=data(:5); %assuming confirmed is present in 5th column
cftool(date,confirmed)
Thanks and Regards,
Saurabh Kumar
  4 件のコメント
John Miles
John Miles 2021 年 3 月 28 日
編集済み: John Miles 2021 年 3 月 28 日
Seems like a simple File -> Load .CSV option would do what 99.9% of users actually want here...?
John D'Errico
John D'Errico 2021 年 3 月 29 日
@John Miles To no surprise, I've NEVER wanted to do exactly that, nor have I seen so many people pleading for that option. So no, it would not be what 99.9% of users would want, just what you want.
A significant problem is it also makes the interface complicated, because a .csv file can contain many things.
The simple answer is to just get used to bringing your data into MATLAB, and then doing whatever you want with it, rather than working from a paradigm that forces you to work directly from (.csv) files. That style of working will be slow and inefficient.

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


John Miles
John Miles 2021 年 3 月 29 日
A significant problem is it also makes the interface complicated
You're killin' me, here

カテゴリ

Help Center および File ExchangeBiological and Health Sciences についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by