Matlab will only print script name in the command prompt, but not run the matlab script.

I'm fairly new to matlab, but have written a piece of code, and while there aren't any problems with the code when I run it on another system, I've been unable to run the script on the computer I would like since it will only print the file name rather then running the code. I've tried reinstalling matlab on this computer and this also does not seem to fix thte problem. The reason for using this computer is that it has the specifications for the task desired. The problem seems to be with running the script itself through the editor, help would be greatly apprecieated!

6 Comments

Without using run button, once try to just type the name of the .m file in the command prompt and click on enter and see if you are able to notice anything.
@Maamoon, can you share your code or sample code which causes you this issue? Otherwise it's be like solving a puzzle game in the dark :)
Thank you both for the response! When I typed the "file name.m" into the command prompt, I got the following error:
"Unable to resolve the name 'Calcium_Imaging.m'."
I can certainly attatch the code below!
% Itterative For Loop For Calcium Imaging Analysis
% Step 1) Collect all the frames of the video into one matlab file
% The full stack images utilized should end in 'G.tiff'
% The Representative Image for ROI detection and should end in 'R.tiff'
% Please see guides for more detailed instructions
toolbox= 'C:\Users\ad-devbiokrolllab\Downloads\CaPTure\toolbox';
files = dir('C:\Users\ad-devbiokrolllab\Desktop\Calcium_Imaging_Analysis_CaPTure\*G.tiff');
bftools = 'C:\Users\ad-devbiokrolllab\Downloads\CaPTure\toolbox\bfmatlab';
disp(files)
addpath(genpath(toolbox)) %Add the toolbox to the matlab working directory when ever you begin a new session
for i = 1:numel(files)
filename = fullfile(files(i).folder, files(i).name);
store_mat(filename,bftools);
disp(['Step_1 Completed:file',num2str(i)]);
end
% Step 2)
files_1 = dir('C:\Users\ad-devbiokrolllab\Desktop\Calcium_Imaging_Analysis_CaPTure\*R.tiff');
microscope= '780';
Threshold= 4;
for i = 1:numel(files_1)
filename_2 = fullfile(files_1(i).folder, files_1(i).name);
segmentation(filename_2, microscope, Threshold)
disp(['Step_2 Completed: file', num2str(i)])
end
% Step 3)
files_3 = dir('C:\Users\ad-devbiokrolllab\Desktop\Calcium Imaging Analysis_CaPTure\*G.mat');
green = {'G.mat'}; %parts of green filename which has to be replaced with red to get the ROI segmentation file
red = {'1_ROI_info_4.mat'};
for i = 1:numel(files_3)
filename_3 = fullfile(files_3(i).folder, files_3(i).name);
extract_traces(filename_3,green,red)
disp(['Step_3 Completed: file',num2str(i)])
end
% Step 4)
files_4 = dir('C:\Users\ad-devbiokrolllab\Desktop\Calcium Imaging Analysis_CaPTure\*traces.mat');
tau = [4 250];
metric = 'mean';
for i = 1:numel(files_4)
filename_4 = fullfile(files_4(i).folder, files_4(i).name);
getDFF(filename_4, tau, metric)
disp(['Step_4 Completed: file',num2str(i)])
end
% Step 5)
files_5 = dir('C:\Users\ad-devbiokrolllab\Desktop\Calcium Imaging Analysis_CaPTure\*dff.mat');
height = 1;
fps = 4;
addpath(genpath(toolbox))
for i = 1:numel(files_5)
filename_5 = fullfile(files_5(i).folder, files_5(i).name);
corrMaps(filename_5, fps, height, toolbox)
disp(['Step_5 Completed: file',num2str(i)])
end
I tried and ran the shared code in MATLAB R2024a, I was able to get the outputs in the workspace without any issue.
When I typed the "file name.m" into the command prompt, I got the following error:
"Unable to resolve the name 'Calcium_Imaging.m'."
  • Do not type "Calcium_Imaging.m" you should not use ".m", just type "Calcium_Imaging" and click enter and see if you are able to notice the outputs.
Thank you for the response! I've tried this and I still get the same issue, the code runs, but I don't get any of the outputs as compared to the other desktop I use. However, I just ran through the script one by one, and am realising that it's skipping over the for loops in my code. Specifically, it skips the steps and just jumps to the end, is this a problem with the mode I'm in potentially?

Sign in to comment.

Answers (1)

I've found out what it is! It was a problem with my code!!! I was calling for all files that ended in '.tiff', as opposed to 'tif'. Thank you all for the help!

Categories

Asked:

on 20 May 2024

Moved:

on 18 Jun 2024

Community Treasure Hunt

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

Start Hunting!