Need test run in Matlab

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Need test run in Matlab

John W. Eaton
Administrator
Could someone please unpack the attached tar file and then execute the
following commands in Matlab and report the results here?

cd fh-bug
fh1 = f1()
fh2 = f2()
fh1 ()
fh2 ()
functions (fh1)
functions (fh2)
inmem
cd subdir
inmem
fh1 ()
fh2 ()
functions (fh1)
functions (fh2)
clear functions
inmem
fh1 ()
fh2 ()
functions (fh1)
functions (fh2)


Thanks,

jwe

fh-bug.tar.gz (460 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Need test run in Matlab

Juan Pablo Carbajal-2
Hi jwe,

These are the results after I modified f1 and f2 (attached; Matlab
2019a doesn't  accept declaration of persistent and initialization in
the same line)


fh1 =

  function_handle with value:

    @gg


fh2 =

  function_handle with value:

    @gg

foo-i-hithere
foo-i-hithere

ans =

  struct with fields:

     function: 'gg'
         type: 'scopedfunction'
         file: 'C:\Users\jcarbaja\Downloads\fh-bug.tar\private\gg.m'
    parentage: {'gg'}


ans =

  struct with fields:

     function: 'gg'
         type: 'scopedfunction'
         file: 'C:\Users\jcarbaja\Downloads\fh-bug.tar\private\gg.m'
    parentage: {'gg'}


ans =

  139×1 cell array

    {'pathdef'                                          }
    {'userpath'                                         }
    {'usejava'                                          }
    {'matlabrc'                                         }
    {'initdesktoputils'                                 }
    {'path'                                             }
    {'mtree.isempty'                                    }
    {'mdbstatus'                                        }
    {'breakpointsForAllFiles'                           }
    {'+editor\private\unmapFile'                        }
    {'+editor\private\doSetBreakpoint'                  }
    {'+editor\private\createJavaBreakpointsFromDbstatus'}
    {'+editor\private\checkFilename'                    }
    {'+editor\private\checkCollection'                  }
    {'Manager'                                          }
    {'EventSource'                                      }
    {'toolboxdir'                                       }
    {'fullfile'                                         }
    {'Channel'                                          }
    {'filesep'                                          }
    {'ispc'                                             }
    {'MessageHandler'                                   }
    {'InputStream'                                      }
    {'OutputStream'                                     }
    {'Stream'                                           }
    {'hgrc'                                             }
    {'ismac'                                            }
    {'ispref'                                           }
    {'opaque.char'                                      }
    {'uitools\private\prefutils'                        }
    {'getAll'                                           }
    {'isSidString'                                      }
    {'canLink'                                          }
    {'strtok'                                           }
    {'loadLinkSet'                                      }
    {'isSupportedFile'                                  }
    {'absolute_path'                                    }
    {'fileparts'                                        }
    {'isCompletePath'                                   }
    {'getLinkFilePath'                                  }
    {'isInstalled'                                      }
    {'ReqData.ReqData'                                  }
    {'ReqData.exists'                                   }
    {'ReqData.getInstance'                              }
    {'StorageMapper.StorageMapper'                      }
    {'date'                                             }
    {'visibleInToolstrip'                               }
    {'hasReqDataFile'                                   }
    {'getSystemObjectInfo'                              }
    {'getSystemObjectInfo'                              }
    {'isSystemObjectFile'                               }
    {'cell.ismember'                                    }
    {'fileread'                                         }
    {'isSystemObjectCode'                               }
    {'ParseTreeUtils'                                   }
    {'mtree.mtfind'                                     }
    {'mtree.isnull'                                     }
    {'mtree.indices'                                    }
    {'mtree.select'                                     }
    {'mtree.mtree'                                      }
    {'@mtree\private\nodeinfo'                          }
    {'@mtree\private\mtree_info'                        }
    {'@mtree\private\collect_qualifiers'                }
    {'getCode'                                          }
    {'mtree.wholetree'                                  }
    {'num2cell'                                         }
    {'Type'                                             }
    {'mtree.count'                                      }
    {'mtree.iskind'                                     }
    {'getFileInfoForToolstrip'                          }
    {'getFunctionFileInfoForToolstrip'                  }
    {'mfile'                                            }
    {'mtree.root'                                       }
    {'ensureServiceOn'                                  }
    {'callConnectorStarted'                             }
    {'callLifecycle'                                    }
    {'Logger'                                           }
    {'LoggerLevel'                                      }
    {'rmiCheckStatus'                                   }
    {'rmipref'                                          }
    {'settings_mgr'                                     }
    {'getInstalledSupportPackagesInfo'                  }
    {'getInstalledSpPkgProducts'                        }
    {'getSupportPackageRootNoCreate'                    }
    {'SupportPackageRootHandler'                        }
    {'isdir'                                            }
    {'SingleRootHandler'                                }
    {'getSprootSettingFileLocation'                     }
    {'SettingWriterReader'                              }
    {'javachk'                                          }
    {'repmat'                                           }
    {'close'                                            }
    {'resetLocalePreference'                            }
    {'configurationSet'                                 }
    {'synchronousNativeBridgeServiceProviderDeliver'    }
    {'Future'                                           }
    {'Promise'                                          }
    {'PromiseState'                                     }
    {'f1'                                               }
    {'opentoline'                                       }
    {'gotoLineOfOpenEditor'                             }
    {'getActionForFileType'                             }
    {'openDocument'                                     }
    {'EditorUtils.EditorUtils'                          }
    {'intmax'                                           }
    {'+editor\private\assertEditorAvailable'            }
    {'isEditorAvailable'                                }
    {'Document.Document'                                }
    {'clearAndSetBreakpointsForFile'                    }
    {'EditorUtils.javaCollectionToArray'                }
    {'fh-bug.tar\private\gg'                            }
    {'getSuiteCreationServicesForToolstrip'             }
    {'SuiteCreationLiaison'                             }
    {'AllowsAnythingNamingConventionService'            }
    {'ServiceLocator'                                   }
    {'ServiceFactory'                                   }
    {'PackageServiceLocator'                            }
    {'SuiteCreationService'                             }
    {'Service'                                          }
    {'ServicePlaceholder'                               }
    {'attributes'                                       }
    {'generateArgumentDescriptor'                       }
    {'FunctionSuiteCreationService'                     }
    {'isFunctionBasedTest'                              }
    {'ScriptSuiteCreationService'                       }
    {'FileBasedStaticAnalysisSuiteCreationService'      }
    {'NamingConventionService'                          }
    {'getSimpleParentName'                              }
    {'NamingConventionLiaison'                          }
    {'NonTestFactory'                                   }
    {'getParentNameFromFilename'                        }
    {'fliplr'                                           }
    {'mtree.Outs'                                       }
    {'mtree.restrict'                                   }
    {'mtree.pathit'                                     }
    {'mtree.Parent'                                     }
    {'mtree.Right'                                      }
    {'TestSuiteFactory'                                 }
    {'f2'                                               }


ans =

  139×1 cell array

    {'pathdef'                                          }
    {'userpath'                                         }
    {'usejava'                                          }
    {'matlabrc'                                         }
    {'initdesktoputils'                                 }
    {'path'                                             }
    {'mtree.isempty'                                    }
    {'mdbstatus'                                        }
    {'breakpointsForAllFiles'                           }
    {'+editor\private\unmapFile'                        }
    {'+editor\private\doSetBreakpoint'                  }
    {'+editor\private\createJavaBreakpointsFromDbstatus'}
    {'+editor\private\checkFilename'                    }
    {'+editor\private\checkCollection'                  }
    {'Manager'                                          }
    {'EventSource'                                      }
    {'toolboxdir'                                       }
    {'fullfile'                                         }
    {'Channel'                                          }
    {'filesep'                                          }
    {'ispc'                                             }
    {'MessageHandler'                                   }
    {'InputStream'                                      }
    {'OutputStream'                                     }
    {'Stream'                                           }
    {'hgrc'                                             }
    {'ismac'                                            }
    {'ispref'                                           }
    {'opaque.char'                                      }
    {'uitools\private\prefutils'                        }
    {'getAll'                                           }
    {'isSidString'                                      }
    {'canLink'                                          }
    {'strtok'                                           }
    {'loadLinkSet'                                      }
    {'isSupportedFile'                                  }
    {'absolute_path'                                    }
    {'fileparts'                                        }
    {'isCompletePath'                                   }
    {'getLinkFilePath'                                  }
    {'isInstalled'                                      }
    {'ReqData.ReqData'                                  }
    {'ReqData.exists'                                   }
    {'ReqData.getInstance'                              }
    {'StorageMapper.StorageMapper'                      }
    {'date'                                             }
    {'visibleInToolstrip'                               }
    {'hasReqDataFile'                                   }
    {'getSystemObjectInfo'                              }
    {'getSystemObjectInfo'                              }
    {'isSystemObjectFile'                               }
    {'cell.ismember'                                    }
    {'fileread'                                         }
    {'isSystemObjectCode'                               }
    {'ParseTreeUtils'                                   }
    {'mtree.mtfind'                                     }
    {'mtree.isnull'                                     }
    {'mtree.indices'                                    }
    {'mtree.select'                                     }
    {'mtree.mtree'                                      }
    {'@mtree\private\nodeinfo'                          }
    {'@mtree\private\mtree_info'                        }
    {'@mtree\private\collect_qualifiers'                }
    {'getCode'                                          }
    {'mtree.wholetree'                                  }
    {'num2cell'                                         }
    {'Type'                                             }
    {'mtree.count'                                      }
    {'mtree.iskind'                                     }
    {'getFileInfoForToolstrip'                          }
    {'getFunctionFileInfoForToolstrip'                  }
    {'mfile'                                            }
    {'mtree.root'                                       }
    {'ensureServiceOn'                                  }
    {'callConnectorStarted'                             }
    {'callLifecycle'                                    }
    {'Logger'                                           }
    {'LoggerLevel'                                      }
    {'rmiCheckStatus'                                   }
    {'rmipref'                                          }
    {'settings_mgr'                                     }
    {'getInstalledSupportPackagesInfo'                  }
    {'getInstalledSpPkgProducts'                        }
    {'getSupportPackageRootNoCreate'                    }
    {'SupportPackageRootHandler'                        }
    {'isdir'                                            }
    {'SingleRootHandler'                                }
    {'getSprootSettingFileLocation'                     }
    {'SettingWriterReader'                              }
    {'javachk'                                          }
    {'repmat'                                           }
    {'close'                                            }
    {'resetLocalePreference'                            }
    {'configurationSet'                                 }
    {'synchronousNativeBridgeServiceProviderDeliver'    }
    {'Future'                                           }
    {'Promise'                                          }
    {'PromiseState'                                     }
    {'f1'                                               }
    {'opentoline'                                       }
    {'gotoLineOfOpenEditor'                             }
    {'getActionForFileType'                             }
    {'openDocument'                                     }
    {'EditorUtils.EditorUtils'                          }
    {'intmax'                                           }
    {'+editor\private\assertEditorAvailable'            }
    {'isEditorAvailable'                                }
    {'Document.Document'                                }
    {'clearAndSetBreakpointsForFile'                    }
    {'EditorUtils.javaCollectionToArray'                }
    {'fh-bug.tar\private\gg'                            }
    {'getSuiteCreationServicesForToolstrip'             }
    {'SuiteCreationLiaison'                             }
    {'AllowsAnythingNamingConventionService'            }
    {'ServiceLocator'                                   }
    {'ServiceFactory'                                   }
    {'PackageServiceLocator'                            }
    {'SuiteCreationService'                             }
    {'Service'                                          }
    {'ServicePlaceholder'                               }
    {'attributes'                                       }
    {'generateArgumentDescriptor'                       }
    {'FunctionSuiteCreationService'                     }
    {'isFunctionBasedTest'                              }
    {'ScriptSuiteCreationService'                       }
    {'FileBasedStaticAnalysisSuiteCreationService'      }
    {'NamingConventionService'                          }
    {'getSimpleParentName'                              }
    {'NamingConventionLiaison'                          }
    {'NonTestFactory'                                   }
    {'getParentNameFromFilename'                        }
    {'fliplr'                                           }
    {'mtree.Outs'                                       }
    {'mtree.restrict'                                   }
    {'mtree.pathit'                                     }
    {'mtree.Parent'                                     }
    {'mtree.Right'                                      }
    {'TestSuiteFactory'                                 }
    {'f2'                                               }

foo-i-hithere
foo-i-hithere

ans =

  struct with fields:

     function: 'gg'
         type: 'scopedfunction'
         file: 'C:\Users\jcarbaja\Downloads\fh-bug.tar\private\gg.m'
    parentage: {'gg'}


ans =

  struct with fields:

     function: 'gg'
         type: 'scopedfunction'
         file: 'C:\Users\jcarbaja\Downloads\fh-bug.tar\private\gg.m'
    parentage: {'gg'}


ans =

  7×1 cell array

    {'Manager'            }
    {'Channel'            }
    {'MessageHandler'     }
    {'InputStream'        }
    {'OutputStream'       }
    {'ReqData.getInstance'}
    {'f1'                 }

foo-i-hithere
foo-i-hithere

ans =

  struct with fields:

     function: 'gg'
         type: 'scopedfunction'
         file: 'C:\Users\jcarbaja\Downloads\fh-bug.tar\private\gg.m'
    parentage: {'gg'}


ans =

  struct with fields:

     function: 'gg'
         type: 'scopedfunction'
         file: 'C:\Users\jcarbaja\Downloads\fh-bug.tar\private\gg.m'
    parentage: {'gg'}


On Wed, Dec 18, 2019 at 2:32 PM John W. Eaton <[hidden email]> wrote:

>
> Could someone please unpack the attached tar file and then execute the
> following commands in Matlab and report the results here?
>
> cd fh-bug
> fh1 = f1()
> fh2 = f2()
> fh1 ()
> fh2 ()
> functions (fh1)
> functions (fh2)
> inmem
> cd subdir
> inmem
> fh1 ()
> fh2 ()
> functions (fh1)
> functions (fh2)
> clear functions
> inmem
> fh1 ()
> fh2 ()
> functions (fh1)
> functions (fh2)
>
>
> Thanks,
>
> jwe

f1.m (130 bytes) Download Attachment
f2.m (118 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Need test run in Matlab

John W. Eaton
Administrator
On 12/18/19 10:11 AM, Juan Pablo Carbajal wrote:

> These are the results

Thanks.

> after I modified f1 and f2 (attached; Matlab
> 2019a doesn't  accept declaration of persistent and initialization in
> the same line)

Oops.

It looks like the private function is loaded the first time it is used
and then also cleared by the "clear functions" command.  But then it
also remains available through the handle.  So I'm wondering whether the
handle should retain a reference to the function and "clear functions"
should only remove it from thh symbol table, or whether it should be
reloaded if it becomes invalid.  I'm thinking the first option would be
best unless someone knows of a reason to do otherwise.

jwe

Reply | Threaded
Open this post in threaded view
|

Re: Need test run in Matlab

John W. Eaton
Administrator
On 12/18/19 12:37 PM, John W. Eaton wrote:

> On 12/18/19 10:11 AM, Juan Pablo Carbajal wrote:
>
>> These are the results
>
> Thanks.
>
>> after I modified f1 and f2 (attached; Matlab
>> 2019a doesn't  accept declaration of persistent and initialization in
>> the same line)
>
> Oops.
>
> It looks like the private function is loaded the first time it is used
> and then also cleared by the "clear functions" command.  But then it
> also remains available through the handle.  So I'm wondering whether the
> handle should retain a reference to the function and "clear functions"
> should only remove it from thh symbol table, or whether it should be
> reloaded if it becomes invalid.  I'm thinking the first option would be
> best unless someone knows of a reason to do otherwise.
Here's another test to run to see whether keeping a reference to the
function in the handle will be compatible with Matlab behavior:  unpack
the attached file and execute the following commands in Matlab:

cd fh-bug
fh = f1
fh()         %% should display "foo-i-hithere: 1"
f2           %% should display "foo-i-hithere: 2"
clear functions   %% what will happen with persistent value in "gg"?
fh()         %% does this display "... 3" or "... 1"?
f2           %% does this display "... 1" or "... 2" or ?

jwe

fh-bug.tar.gz (504 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Need test run in Matlab

fmlburgers
Op 18-12-2019 om 18:51 schreef John W. Eaton:

> On 12/18/19 12:37 PM, John W. Eaton wrote:
>> On 12/18/19 10:11 AM, Juan Pablo Carbajal wrote:
>>
>>> These are the results
>>
>> Thanks.
>>
>>> after I modified f1 and f2 (attached; Matlab
>>> 2019a doesn't  accept declaration of persistent and initialization in
>>> the same line)
>>
>> Oops.
>>
>> It looks like the private function is loaded the first time it is used
>> and then also cleared by the "clear functions" command.  But then it
>> also remains available through the handle.  So I'm wondering whether
>> the handle should retain a reference to the function and "clear
>> functions" should only remove it from thh symbol table, or whether it
>> should be reloaded if it becomes invalid.  I'm thinking the first
>> option would be best unless someone knows of a reason to do otherwise.
>
> Here's another test to run to see whether keeping a reference to the
> function in the handle will be compatible with Matlab behavior:  unpack
> the attached file and execute the following commands in Matlab:
>
> cd fh-bug
> fh = f1
> fh()         %% should display "foo-i-hithere: 1"
> f2           %% should display "foo-i-hithere: 2"
> clear functions   %% what will happen with persistent value in "gg"?
> fh()         %% does this display "... 3" or "... 1"?
> f2           %% does this display "... 1" or "... 2" or ?
>
> jwe

I get this:

 >> version
ans = '9.5.0.1049112 (R2018b) Update 3'

 >> cd fh-bug
 >> fh = f1

fh =  function_handle with value:    @gg

 >> fh()
foo-i-hithere: 1
 >> f2
foo-i-hithere: 2
 >> clear functions
 >> fh()
foo-i-hithere: 1
 >> f2
foo-i-hithere: 2


Reply | Threaded
Open this post in threaded view
|

Re: Need test run in Matlab

John W. Eaton
Administrator
On 12/18/19 2:53 PM, Burgers, A.R. (Teun) wrote:

> Op 18-12-2019 om 18:51 schreef John W. Eaton:
>> On 12/18/19 12:37 PM, John W. Eaton wrote:
>>> On 12/18/19 10:11 AM, Juan Pablo Carbajal wrote:
>>>
>>>> These are the results
>>>
>>> Thanks.
>>>
>>>> after I modified f1 and f2 (attached; Matlab
>>>> 2019a doesn't  accept declaration of persistent and initialization in
>>>> the same line)
>>>
>>> Oops.
>>>
>>> It looks like the private function is loaded the first time it is
>>> used and then also cleared by the "clear functions" command.  But
>>> then it also remains available through the handle.  So I'm wondering
>>> whether the handle should retain a reference to the function and
>>> "clear functions" should only remove it from thh symbol table, or
>>> whether it should be reloaded if it becomes invalid.  I'm thinking
>>> the first option would be best unless someone knows of a reason to do
>>> otherwise.
>>
>> Here's another test to run to see whether keeping a reference to the
>> function in the handle will be compatible with Matlab behavior:  
>> unpack the attached file and execute the following commands in Matlab:
>>
>> cd fh-bug
>> fh = f1
>> fh()         %% should display "foo-i-hithere: 1"
>> f2           %% should display "foo-i-hithere: 2"
>> clear functions   %% what will happen with persistent value in "gg"?
>> fh()         %% does this display "... 3" or "... 1"?
>> f2           %% does this display "... 1" or "... 2" or ?
>>
>> jwe
>
> I get this:
>
>  >> version
> ans = '9.5.0.1049112 (R2018b) Update 3'
>
>  >> cd fh-bug
>  >> fh = f1
>
> fh =  function_handle with value:    @gg
>
>  >> fh()
> foo-i-hithere: 1
>  >> f2
> foo-i-hithere: 2
>  >> clear functions
>  >> fh()
> foo-i-hithere: 1
>  >> f2
> foo-i-hithere: 2

Thanks.

So it looks like "clear functions" also clears functions that are
referenced by function handles, but then those handles are able to
reload them from their initial location, even if that is no longer in
the search path (as shown by the first tests I posted earlier).  Does
that seem like the correct interpretation?  To be sure, does the above
work the same if you do

   cd fh-bug
   fh = f1
   fh()
   f2
   cd ..
   clear functions
   fh()  %% does this still work?
   f2  %% expect error here as f2 is no longer in the search path

jwe


Reply | Threaded
Open this post in threaded view
|

Re: Need test run in Matlab

fmlburgers
Op 19-12-2019 om 00:30 schreef John W. Eaton:

> On 12/18/19 2:53 PM, Burgers, A.R. (Teun) wrote:
>> Op 18-12-2019 om 18:51 schreef John W. Eaton:
>>> On 12/18/19 12:37 PM, John W. Eaton wrote:
>>>> On 12/18/19 10:11 AM, Juan Pablo Carbajal wrote:
>>>>
>>>>> These are the results
>>>>
>>>> Thanks.
>>>>
>>>>> after I modified f1 and f2 (attached; Matlab
>>>>> 2019a doesn't  accept declaration of persistent and initialization in
>>>>> the same line)
>>>>
>>>> Oops.
>>>>
>>>> It looks like the private function is loaded the first time it is
>>>> used and then also cleared by the "clear functions" command.  But
>>>> then it also remains available through the handle.  So I'm wondering
>>>> whether the handle should retain a reference to the function and
>>>> "clear functions" should only remove it from thh symbol table, or
>>>> whether it should be reloaded if it becomes invalid.  I'm thinking
>>>> the first option would be best unless someone knows of a reason to
>>>> do otherwise.
>>>
>>> Here's another test to run to see whether keeping a reference to the
>>> function in the handle will be compatible with Matlab behavior:
>>> unpack the attached file and execute the following commands in Matlab:
>>>
>>> cd fh-bug
>>> fh = f1
>>> fh()         %% should display "foo-i-hithere: 1"
>>> f2           %% should display "foo-i-hithere: 2"
>>> clear functions   %% what will happen with persistent value in "gg"?
>>> fh()         %% does this display "... 3" or "... 1"?
>>> f2           %% does this display "... 1" or "... 2" or ?
>>>
>>> jwe
>>
>> I get this:
>>
>>  >> version
>> ans = '9.5.0.1049112 (R2018b) Update 3'
>>
>>  >> cd fh-bug
>>  >> fh = f1
>>
>> fh =  function_handle with value:    @gg
>>
>>  >> fh()
>> foo-i-hithere: 1
>>  >> f2
>> foo-i-hithere: 2
>>  >> clear functions
>>  >> fh()
>> foo-i-hithere: 1
>>  >> f2
>> foo-i-hithere: 2
>
> Thanks.
>
> So it looks like "clear functions" also clears functions that are
> referenced by function handles, but then those handles are able to
> reload them from their initial location, even if that is no longer in
> the search path (as shown by the first tests I posted earlier).  Does
> that seem like the correct interpretation?  To be sure, does the above
> work the same if you do
>
>    cd fh-bug
>    fh = f1
>    fh()
>    f2
>    cd ..
>    clear functions
>    fh()  %% does this still work?
>    f2  %% expect error here as f2 is no longer in the search path
>
> jwe

In that scenario I get this. Also the response after the last f2 command
is not immediate, the search for f2 takes some time, probably because of
network locations in the path.

 >> cd fh-bug
 >> fh=f1

fh =  function_handle with value:   @gg

 >> fh()
foo-i-hithere: 1
 >> f2
foo-i-hithere: 2
 >> cd ..
 >> clear functions
 >> fh()
foo-i-hithere: 1
 >> f2
'f2' is not found in the current folder or on the MATLAB path, but
exists in:
     C:\tmp\tmp\fh-bug

Change the MATLAB current folder or add its folder to the MATLAB path.

 >>



Reply | Threaded
Open this post in threaded view
|

Re: Need test run in Matlab

John W. Eaton
Administrator
On 12/19/19 2:47 AM, Burgers, A.R. (Teun) wrote:

> In that scenario I get this. Also the response after the last f2 command
> is not immediate, the search for f2 takes some time, probably because of
> network locations in the path.
>
>  >> cd fh-bug
>  >> fh=f1
>
> fh =  function_handle with value:   @gg
>
>  >> fh()
> foo-i-hithere: 1
>  >> f2
> foo-i-hithere: 2
>  >> cd ..
>  >> clear functions
>  >> fh()
> foo-i-hithere: 1

OK, so the function is cleared (the persistent variable is reset to the
initial value) but it is reloaded from the same location that is no
longer in the path.  I should have also asked, after it is reloaded,
does inmem show it?

>  >> f2
> 'f2' is not found in the current folder or on the MATLAB path, but
> exists in:
>      C:\tmp\tmp\fh-bug
>
> Change the MATLAB current folder or add its folder to the MATLAB path.

Interesting, so it appears to remember functions (or directories)
previously in the search path so that it can issues warnings like that one.

Thanks!

jwe


Reply | Threaded
Open this post in threaded view
|

Re: Need test run in Matlab

Burgers, A.R. (Teun)
Op 19-12-2019 om 16:56 schreef John W. Eaton:

> On 12/19/19 2:47 AM, Burgers, A.R. (Teun) wrote:
>
>> In that scenario I get this. Also the response after the last f2
>> command is not immediate, the search for f2 takes some time, probably
>> because of network locations in the path.
>>
>>  >> cd fh-bug
>>  >> fh=f1
>>
>> fh =  function_handle with value:   @gg
>>
>>  >> fh()
>> foo-i-hithere: 1
>>  >> f2
>> foo-i-hithere: 2
>>  >> cd ..
>>  >> clear functions
>>  >> fh()
>> foo-i-hithere: 1
>
> OK, so the function is cleared (the persistent variable is reset to the
> initial value) but it is reloaded from the same location that is no
> longer in the path.  I should have also asked, after it is reloaded,
> does inmem show it?
>
>>  >> f2
>> 'f2' is not found in the current folder or on the MATLAB path, but
>> exists in:
>>      C:\tmp\tmp\fh-bug
>>
>> Change the MATLAB current folder or add its folder to the MATLAB path.
>
> Interesting, so it appears to remember functions (or directories)
> previously in the search path so that it can issues warnings like that one.
>
> Thanks!
>
> jwe
>
>
>
Here some inmem results:

 >> clear all
 >> clear all
 >> inmem

ans =  7×1 cell array

     {'Manager'       }
     {'Channel'       }
     {'MessageHandler'}
     {'InputStream'   }
     {'OutputStream'  }
     {'FevalService'  }
     {'MatlabService' }

 >> cd fh-bug
 >> fh=f1

fh =  function_handle with value:   @gg

 >> fh()
foo-i-hithere: 1

 >> f2
foo-i-hithere: 2

 >> inmem

ans = 10×1 cell array

     {'Manager'          }
     {'Channel'          }
     {'MessageHandler'   }
     {'InputStream'      }
     {'OutputStream'     }
     {'FevalService'     }
     {'MatlabService'    }
     {'f1'               }
     {'fh-bug\private\gg'}
     {'f2'               }

 >> cd ..
 >> clear functions
 >> inmem

ans =

   7×1 cell array

     {'Manager'       }
     {'Channel'       }
     {'MessageHandler'}
     {'InputStream'   }
     {'OutputStream'  }
     {'FevalService'  }
     {'MatlabService' }

 >> fh()
foo-i-hithere: 1
 >> inmem

ans =

   8×1 cell array

     {'Manager'          }
     {'Channel'          }
     {'MessageHandler'   }
     {'InputStream'      }
     {'OutputStream'     }
     {'FevalService'     }
     {'MatlabService'    }
     {'fh-bug\private\gg'}