matlab - 读取带有标题的文件并提取数据
问题描述
我正在尝试从文件中提取数据。该文件包含 37 列,每列都有一个标题。我似乎不能只提取数据。我不确定要使用什么功能。最终我需要执行一些计算,然后输出更多数据。
我尝试过使用 dlmread、textscan、load 和其他一些。我不太了解这些函数如何与不同类型交互。我已经仔细检查了我正在打开正确的文件并且文件中填充了值。
% Prompt user to select the folder containing the data
testfolder = uigetdir();
datastore = zeros (0,37);
for i= 1:2
subfoldertxt = [testfolder, '\t.txt'];
%datastore = dlmread(subfoldertxt,',');
store = textscan(subfoldertxt,'%s','delimiter',',', 'HeaderLines', 37
);
datastore = textscan(subfoldertxt,'%f', 'delimiter','\t');
%There are 37 columns. 18 are used as pairs, one column (the 15th) is left
over.
for column = 1:18
if column < 15
Error(:,column)=datastore(:,column) - datastore (:, column + 18);
elseif column >15
Error(:,column)= datastore(:,column) -datastore(:, column + 19);
end
end
我希望数据存储保存文件中的值,以便可以计算错误。目前我得到一个完全为空的 1x1 单元阵列。
解决方案
推荐阅读
- python - 无法使用 tkinter 分隔列表框和按钮
- reactjs - 在外部包中使用主题提供者注入主题道具
- symfony - Symfony 包可以有自己的 Webpack Encore 配置吗?
- r - webshot 不打印地图
- sql - 按带有 case-when 的参数排序
- docker - 覆盖/更新 docker 容器的环境变量
- python - 打字:如何考虑用部分包装的类参数?
- parallel-processing - Cython:SIMD 和 OpenMP 不能很好地协同工作
- android - Android 自定义视图:如何将任意嵌套视图膨胀到自定义 ViewGroup 的另一个后代中
- templates - Yii 1.1 的现代模板解决方案