PROBLEMS WITH SAVING PATHFOLDERS

Hello, currently I'm working with exiftool to change the attributes from some pictures, I run this script in my computer and I don't have any problem with them, however when I install Matlab2021a in my office computer, I run my script and I have and adverstiment about the script doesn't find the specified path. I don't know what it's problem, I give all the permits to all users but neither. Please help to find some answer or solution to my problem.

2 Commenti

Do you receive warning and/or error messages? If so the full and exact text of those messages (all the text displayed in orange and/or red in the Command Window) may be useful in determining what's going on and how to avoid the warning and/or error. Don't paraphrase, don't summarize, copy and paste.
You may also need to show us a small sample of code with which we can attempt to reproduce the problem.
Galo Oviedo
Galo Oviedo il 8 Gen 2024
Modificato: Stephen23 il 9 Gen 2024
No, the only warning that I recieve is this:
This is my code, I do in a function however I test this in my house computer and the code works well.
function batchAddAndExportCoordinatesWithFile(folderPath, outputFolderPath, coordinatesFilePath)
% Specify the path to the ExifTool executable
exiftoolPath = 'C:\EXIFTOOL\exiftool.exe';
% Read coordinates from the TXT file
coordinatesData = importdata(coordinatesFilePath);
% Get a list of all JPG files in the specified folder
files = dir(fullfile(folderPath, '*.jpg'));
% Check if the number of coordinates matches the number of images
if length(coordinatesData) ~= length(files)
error('Number of coordinates in the file does not match the number of images.');
end
% Iterate through each file and apply the function
for i = 1:length(files)
% Full path to the original image
originalImagePath = fullfile(folderPath, files(i).name);
% Create the output file path based on the original file name
[~, fileName, fileExt] = fileparts(files(i).name);
outputImagePath = fullfile(outputFolderPath, [fileName '**' fileExt]);
% Extract coordinates from the data read from the file
currentCoordinates = coordinatesData(i,:);
latitude = currentCoordinates(1);
longitude = currentCoordinates(2);
% Build the command to add GPS coordinates and export to a new file
command = [exiftoolPath ' -GPSLatitude=' num2str(latitude) ' -GPSLongitude=' num2str(longitude) ' -o ' outputImagePath ' ' originalImagePath];
% Execute the command using the system function
status = system(command);
% Display status for each image
if status == 0
disp(['Coordinates added and image exported successfully: ' files(i).name]);
else
disp(['Error processing ' files(i).name]);
end
end
end
clc;
clear all;
close all;
% BATCH OF PROCESS
folderPath = '\path\folder\test';
coordinatesFilePath = 'coordinates\test\coordinates.txt';
outputFolderPath = '\output\folder\test2';
batchAddAndExportCoordinatesWithFile(folderPath, outputFolderPath, coordinatesFilePath);
All the paths are an example not the originals.

Accedi per commentare.

Risposte (2)

I'd say that you don't have the folderpath on your computer
folderPath = '\path\folder\test';
or else the images are not in that particular folder.

2 Commenti

Galo Oviedo
Galo Oviedo il 8 Gen 2024
Spostato: Image Analyst il 8 Gen 2024
That path it’s only an example not the original path
Well whatever it is, the answer is the same. That folder does not exist or the files are not in it. What does this say
folderPath = '\path\folder\test'; % Replace with actual path
if ~isfolder(folderPath)
errorMessage = sprintf('The folder %s does not exist!', folderPath)
errordlg(errorMessage);
return;
else
message = sprintf('The folder %s does exist!', folderPath)
uiwait(helpdlg(message));
end

Accedi per commentare.

Image Analyst
Image Analyst il 9 Gen 2024

0 voti

I noticed that you included the drive letter in one path but not the others. Try putting the drive letter in all paths. What operating system are you using? Does it use drive letters (Windows) or not (Unix, mac)?

Categorie

Scopri di più su External Language Interfaces in Centro assistenza e File Exchange

Richiesto:

il 8 Gen 2024

Risposto:

il 9 Gen 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by