How do I load the desired columns and rows I want from a csv file?

11 ビュー (過去 30 日間)
Format_31
Format_31 2019 年 10 月 11 日
回答済み: Walter Roberson 2019 年 10 月 12 日
With a csv file , how can I load from the second row to the last data point row in the second column from my excel data set. I have tried using readtable and csvread but can’t seem to figure out how to access the rows and column I want starting from the second row and second column.
I’m running 2018b

回答 (2 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2019 年 10 月 11 日
Hi,
The good solution of your exercise is to use xlsread(), e.g. DATA = xlsread('MY_data.xls', 1, 'B1:B999');
Note that the file name and extension exactly and B1:B999 means from column 2 all data from cell B1 up to B999.
Good luck.
  2 件のコメント
Format_31
Format_31 2019 年 10 月 12 日
Thank you. I tried that but it doesn’t work the same for .csv files. I’m trying to keep my time stamps in their format and it seems like the .csv file format works well for doing so but pulling accessing the correct rows and column is more challenging.
Any ideas for how to do it with a .csv file?
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2019 年 10 月 12 日
can you post your sample data file?

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


Walter Roberson
Walter Roberson 2019 年 10 月 12 日
readtable() with 'HeaderLines', 1 and 'ReadVariableNames', false

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by