How to open and read .ffs file matlab?
11 次查看(过去 30 天)
显示 更早的评论
Hello! I have an .ffs file (see image 1).
I am doind this in matlab to get it and open it:
>> [radiationfile, path] = uigetfile('*.ffs');
>> radiationfile = fileread(radiationfile);
But now I don't know how to save the important parts of the file. I just want to save in an array the variables Phi (which corresponds to the first column), Theta (the second column) and so forth for the others.
I want to do this in appDesigner. The user chose some .ffs file and the code save the important variables, which can not always be in the same lines.
Is there any function I don't know to help me? I will send you the file in .txt just for you to understand better. I changed it to .txt because it is not possible to upload a .ffs file. But in the code I want that file to be .ffs
Thank you!!
0 个评论
采纳的回答
Voss
2022-5-22
% (first, make the attached .txt file an .ffs file)
copyfile('SpiralAntennaBox_v02_FarField_4p5GHz.txt','SpiralAntennaBox_v02_FarField_4p5GHz.ffs');
It looks like readmatrix will work; just specify 'FileType','text' due to the unrecognized extension:
% Option 1: use readmatrix:
data = readmatrix('SpiralAntennaBox_v02_FarField_4p5GHz.ffs','FileType','text')
Or, here's one way to complete the approach you were working on, using fileread:
% Option 2: use fileread:
radiationfile = fileread('SpiralAntennaBox_v02_FarField_4p5GHz.ffs');
idx = strfind(radiationfile,':');
data = str2num(radiationfile(idx(end)+1:end))
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!