Hello .. how to read a text file which is a matrix of [1000x512] order of complex numbers. could anyone please help me over this

3 次查看(过去 30 天)
I have a file that is matrix of complex numbers with order 1000x512 . I used csvread, textscan to read file . But I am facing problem in reading a file .kindly help me

采纳的回答

Jeremy Hughes
Jeremy Hughes 2018-2-8
Hi Darapu,
This worked for me.
T = readtable('Extracted_Dry_Tar_Road_prediction_file.txt','Whitespace',' ()');
T.Variables
Hope this helps,
Jeremy

更多回答(2 个)

Birdman
Birdman 2018-2-8
编辑:Birdman 2018-2-8
This does it. The complex numbers are stored in a cell array:
fileID=fopen('Extracted_Dry_Tar_Road_prediction_file.txt','r');
Data=textscan(fileID,'%s');
Data=string(regexprep(Data{1},'[,()]',''));
Data=cellfun(@(x) str2double(x),Data,'uni',0)
fclose(fileID);
which you can reach any of them by typing
Data{1}
Data{2}
and so on.

Sudeepini
Sudeepini 2018-2-9
Thank you

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by