我采取了不同的措施,并将其保存为* .log文件,然后对其进行计算并另存为。* txt。
%Filtering log files
l = dir('*.log');
%Array size detection
[rows cols] = size(l);
%Choose a last file
file_name = strcat(strcat(l(rows).folder,'/'),l(rows).name)
%Reading log last file
fileread = fopen(file_name);
%Convert to float
times = fread(fileread,'float32');
%Filtering times and set to 0 small values
times(times<1e-8)=0;
%Set right times values
times_s = times * 1.0e-06;
%Solve full rotation speed (Hz)
motorspeed_full = 1./(2.*times_s)
%Filtering inf values and set to 0
motorspeed_full(motorspeed_full>1e+10)=0;
%Solve half rotation speed (Hz)
motorspeed_half = 1./(times_s);
A = '.txt';
[filepath,name,ext] = fileparts(file_name);
Xfilename = cat(2,name,A);
dlmwrite(Xfilename,motorspeed_full,'precision','%.3f');
因此,可以选择最后一个文件,对其进行计算并将其转换为。* txt。所以现在,我必须在每次测量后进行计算。
我的目标是:
问题:
如何创建一个具有file_name的新文件夹
mkdir(name);
对于所有文件?
如何将同名文件移动到同名文件夹?文件夹名称每次都会更改,因此我无法使用
移动文件源目标
非常感谢您的帮助:*)
答案 0 :(得分:0)
这是我的解决方案。也许可以帮助某人:
(x*y)%z == ((x%z) * (y%z)) % z