simple readtable() call throws error
显示 更早的评论
Trying to run a one line script containing:
data = readtable("data.txt");
Where "data.txt" is in the same directory and contains:
0, 1
100, 2
200, 3
300, 4
400, 5
And I get the error:
Error using readtable
Dimensions of arrays being concatenated are not consistent.
Error in readtabletest (line 1)
data = readtable("data.txt");
What arrays are being concatenated??
I have tried changing the delimeter to spaces too
8 个评论
Works fine for me here -
data = readtable("data.txt")
Can you upload your "data.txt" file so we can reproduce the error?
Brandyn Butchard
2023-6-27
Brandyn Butchard
2023-6-27
Hiro Yoshino
2023-6-28
It worked fine with me too.
What MATLAB version do you use?
Star Strider
2023-6-28
See Release in the right margin of this page.
Cris LaPierre
2023-6-28
Pleaes share the result of the following code
which readtable -all
Brandyn Butchard
2023-6-28
回答(1 个)
1st of all, verify and make sure that if you're calling the correct file. You may have two different files with the same name but different contents in two different directories
Here are four different ways to read data from data.txt:
D1 = readtable('data.txt')
D2 = readmatrix('data.txt')
D3 = importdata('data.txt')
D4 = dlmread('data.txt') % Not recommended
类别
在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!