If you have a complicated project with many functions interconnected with each other, debugging could be a pain in the neck. To make it a bit more easier, I personally write "current status" of the code to a text file. Every time a specific event is caused, I write to the text file, along with the timestamp of the message. This helps me often, to pin point the mistake in my code. This is fairly simple thing to do. See the below function, write_log.m function write_log(msg) fid = fopen(fullfile(pwd, 'LogFile.txt' ), 'a' ); if fid == -1 error( 'Cannot open log file.' ); end fprintf(fid, '%s: %s\r\n' , datestr(now, 0), msg); %this line could be changed to add more details to the message fclose(fid); end pwd stands for present working directory. I want to save the LogFile in the same directory as the current project. Every time the message, indicated by the variable msg here, is written to the text file, I precede...
Sharing my share of knowledge in the technical world