How to open and read .ffs file matlab?
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Voss
le 22 Mai 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))
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Workspace Variables and MAT-Files dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!