We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
以下是一个例子, 你需要根据x, y坐标的对应位置决定是否需要交换x和y坐标的位置
root_folder = '';
% 获取根文件夹中所有子文件夹的列表 subfolders = dir(root_folder); subfolders = subfolders([subfolders.isdir] & ~strcmp({subfolders.name}, '.') & ~strcmp({subfolders.name}, '..'));
% 遍历每个子文件夹 for s = 1:length(subfolders) subfolder_path = fullfile(root_folder, subfolders(s).name, 'mats');
% 获取子文件夹中所有.mat文件的列表 mat_files = dir(fullfile(subfolder_path, '*.mat')); % 获取.txt文件保存的路径 output_folder = fullfile(fileparts(subfolder_path), 'txt'); if ~exist(output_folder, 'dir') mkdir(output_folder); end % 循环处理每个.mat文件 for i = 1:length(mat_files) % 读取.mat文件 file_path = fullfile(subfolder_path, mat_files(i).name); data = load(file_path); % 提取image_info.location locations = data.image_info.location; % 交换x和y坐标的位置 swapped_locations = [locations(:,2), locations(:,1)]; % 获取.mat文件的基本文件名(不包括扩展名) [~, base_name, ~] = fileparts(mat_files(i).name); % 构建.txt文件的保存路径 output_file_path = fullfile(output_folder, [base_name, '.txt']); % 打开输出的文本文件 output_file = fopen(output_file_path, 'w'); % 写入.txt文件 fprintf(output_file, '%f %f\n', swapped_locations'); % 关闭输出文件 fclose(output_file); end
end
Sorry, something went wrong.
感谢,我尝试一下
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: