How to open and read .ffs file matlab?
11 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Voss
on 22 May 2022
% (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))
More Answers (0)
See Also
Categories
Find more on Workspace Variables and MAT-Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!