Hello Jakub Zlamal
                            
Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.
                            If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.
                         
                     
                    
                        
                        
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                1 decade ago                            
                            
                                Feb 24, 2011, 9:29 a.m. EST                            
                        
                        
                                                    I have the same problem: I'm trying to set a breakpoint in a Matlab functiona that is being called by Comsol for debugging purposes.
any Idea on how to do that?                                                
                                                
                            I have the same problem: I'm trying to set a breakpoint in a Matlab functiona that is being called by Comsol for debugging purposes.
any Idea on how to do that?                        
                                                
                                                                                                            
                                             
                    
                    
                        
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                1 decade ago                            
                            
                                Feb 24, 2011, 10:23 a.m. EST                            
                        
                        
                                                    It is not possible to debug MATLAB function. (Only possibility is to write debug information in matlab function to file and look at it).
If You change function You must restart comsol to take changes into account or use clearfunction in MATLAB prompt
                                                
                                                
                            It is not possible to debug MATLAB function. (Only possibility is to write debug information in matlab function to file and look at it).
If You change function You must restart comsol to take changes into account or use clearfunction in MATLAB prompt
                        
                                                
                                                                                                            
                                             
                    
                    
                        
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                1 decade ago                            
                            
                                Nov 5, 2012, 10:36 a.m. EST                            
                        
                        
                                                    My (dirty) solution:
function C = add(a,b)
fid = fopen('/home/user/log','w');
fprintf(fid,'display your debug log\n');
fclose(fid)
end
I use a file as debug log. It works but it's not an ideal solution...                                                
                                                
                            My (dirty) solution:
function C = add(a,b)
fid = fopen('/home/user/log','w');
fprintf(fid,'display your debug log\n');
fclose(fid)
end
I use a file as debug log. It works but it's not an ideal solution...                        
                                                
                                                                                                            
                                             
                    
                    
                        
                            
                                                                                        
                                Remi Magnard
                                                                                                                                                    COMSOL Employee
                                                         
                            
                                                                                                                                                
                         
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                1 decade ago                            
                            
                                Nov 7, 2012, 4:52 a.m. EST                            
                        
                        
                                                    If you are running COMSOL on Windows you can benefit of the MATLAB debugger.
What you need to do is:
1- Evaluate first the function so that a MATLAB process is started, for instance use the plot button in the function settings tab.
2- At the MATLAB prompt, that should have poped-up automatically to evaluate the function, type:  desktop
3- You can now edit the function and add break point.
4- When running the model,the MATLAB debugger automatically stops at the break point and you can verify the intermediate value of the function variables.
This is also described in the LiveLink for MATLAB User's guide: Calling MATLAB function > The MATLAB Function Feature Node > Using the MATLAB Debugger (Windows only), (page 185 in the COMSOL 4.3a documentation)
Enjoy the modeling !   
                                                 
                                                
                            If you are running COMSOL on Windows you can benefit of the MATLAB debugger.
What you need to do is:
1- Evaluate first the function so that a MATLAB process is started, for instance use the plot button in the function settings tab.
2- At the MATLAB prompt, that should have poped-up automatically to evaluate the function, type:  desktop
3- You can now edit the function and add break point.
4- When running the model,the MATLAB debugger automatically stops at the break point and you can verify the intermediate value of the function variables.
This is also described in the LiveLink for MATLAB User's guide: Calling MATLAB function > The MATLAB Function Feature Node > Using the MATLAB Debugger (Windows only), (page 185 in the COMSOL 4.3a documentation)
Enjoy the modeling !   
                         
                                                
                                                                                                            
                                             
                    
                    
                        
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                10 years ago                            
                            
                                Apr 20, 2016, 2:33 p.m. EDT                            
                        
                        
                                                    I've been searching for a solution to this problem as well. I followed the instructions provided, but when I click 'compute' to run my Comsol model, all of my breakpoints disappear in my matlab functions. Do I need to pass any sort of flag when I type desktop, that enables debugging? Or is this some sort of glitch?
For reference, I am using version 5.1
Thanks                                                
                                                
                            I've been searching for a solution to this problem as well. I followed the instructions provided, but when I click 'compute' to run my Comsol model, all of my breakpoints disappear in my matlab functions. Do I need to pass any sort of flag when I type desktop, that enables debugging? Or is this some sort of glitch?
For reference, I am using version 5.1
Thanks                        
                                                
                                                                                                            
                                             
                    
                    
    
                        
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                10 years ago                            
                            
                                Apr 20, 2016, 6:07 p.m. EDT                            
                        
                        
                                                    In case anyone else is having problems, I discovered that if you have 'Clear functions automatically before solving' selected for your Matlab function, it resets all the breakpoints in that function prior to running. This box is useful if you have made any changes to your function since Comsol last used it, but is unnecessary otherwise. If this box is unchecked, you can proceed with debugging.                                                
                                                
                            In case anyone else is having problems, I discovered that if you have 'Clear functions automatically before solving' selected for your Matlab function, it resets all the breakpoints in that function prior to running. This box is useful if you have made any changes to your function since Comsol last used it, but is unnecessary otherwise. If this box is unchecked, you can proceed with debugging.