Error showing. "Cannot CD to /Users/bas​u/Desktop/​Confocal_I​mages/TNF_​TREATMENT (Name is nonexistent or not a directory).Error in IMAGE_ANALYSIS (line 37) cd (pathInputQuantt)"

1 view (last 30 days)
pathInputQuantt='/Users/basu/Desktop/Confocal_Images/TNF_TREATMENT'% GFP image directory
pathInputTrack='Users/basu/Desktop/Confocal_Images/TNF_TREATMENT'% HOE image directory
pathOutput=pwd; %purpose?
t = clock; %purpose?
% Find the GFP and HOE images from the directory
cd (pathInputQuantt);
fnamesQUANT = dir('RelA.tiff'); % Get the GFP image: Cell
cd (pathInputTrack);
fnamesTRACK = dir('DAPI.tiff'); % Get the HOE image: Nucleus
restoredefaultpath
rehash toolboxcache
savepath
% Get the file names
fileNameQuant = dir('DAPI.tiff');
fileNameTrack = dir('RelA.tiff');
% Get the GFP image (Quant)
fileAddress='C:/Users/basu/Desktop/Confocal_Images/TNF_TREATMENT/UN_TNF_WT/', dir('RelA.tiff'); % Get the full file name
StackQuant.data = rgb2gray(imread(fileAddress)); % Get the image
%StackQuant.data = StackQuant.data(:,:,2);
[StackQuant.height, StackQuant.width] = size(StackQuant.data); % Get the size of the image
% Get the HOE image (Track)
fileAddress=[pathInputTrack, fileNameTrack]; % Get the full file name
StackTrack.data = rgb2gray(imread(fileAddress)); % Get the image
%StackTrack.data = StackTrack.data(:,:,3);
[StackTrack.height, StackTrack.width] = size(StackTrack.data); % Get the size of the image

Answers (1)

Raghav
Raghav on 4 Apr 2023
Hi,
Based on your question, I understand that you are facing path changing related difficulty while executing your program.
Based on the code provided and the error, there can be following possible reasons for this error:
  1. It is possible that the path you are trying to access i.e. the folder is not present at the location provided by you in ‘pathInputQuantt’.
  2. Another reason may be that the path is not added to the MATLAB path. You can do so by going to MATLAB > Home Tab > Set Path. And then you may add it to the path and save it.
Also, I will recommend you to check the path again as there is no drive mentioned before ‘/Users’.
Hope it helps!
Thanks,
Raghav Bansal

Categories

Find more on Medical Physics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!