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!