problem with table / array/cell
13 ビュー (過去 30 日間)
古いコメントを表示
Hi ,
The function is converting table to cell instead of table to array matrix.
I need a simple array vector for each column to plot and to do further calculation
clear all;
close all;
clc;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/309014/image.jpeg)
TXT_FileName='Fundamental + Harmonic distortion components.txt';
filedata = readtable(TXT_FileName,'delimiter','\t','readvariablenames',true);
A = table2array(filedata);
array = table2array(filedata(3:end,:));
% row=2;
% A(row,:)=[];
% row=1;
% A(row,:)=[];
Freq = array(:,1);
All_Fun_SPL = array(:,2);
% plot(Freq(:,1),All_Fun_SPL(:,1));
2 件のコメント
Mohammad Sami
2020 年 6 月 3 日
I think the readtable is not detecting your header rows, you may want to explicitly state how many header rows there are. This causes it import data as cell string rather then as numeric values.
回答 (1 件)
Stephan
2020 年 6 月 3 日
編集済み: Stephan
2020 年 6 月 3 日
Your table content is a cell array - Read the Tips section from the documentation. It tells you why and how to deal with it.
cell2mat(table2cell(T))
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!