bugGNU Octave - Bugs: bug #57041, Missing Matlab functions:...

 
 

bug #57041: Missing Matlab functions: startsWith and endsWith

Submitter:  amrit karmacharya <amritkarma>
Submitted:  Fri 11 Oct 2019 02:24:48 PM UTC
   
 
Category:  Octave Function Severity:  1 - Wish
Priority:  3 - Low Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 15 Apr 2020 06:55:01 PM UTC, comment #26: 

Added your name to the manual here:
http://hg.savannah.gnu.org/hgweb/octave/rev/1f07b80db239

Closing as fixed.

Markus Mützel <mmuetzel>
Group administrator
Mon 13 Apr 2020 06:46:02 PM UTC, comment #25: 


> I made some modifications and pushed your patch here:
> http://hg.savannah.gnu.org/hgweb/octave/rev/d052c11d47c6


Glad to hear that =)

> Would you like to be acknowledged as a contributor at the beginning of the manual? Should your middle name or initial be included?


Surely, I would like to. my middle name is Khaled, Abdallah K. Elshamy would be fine.

I am truly thankful for your help, thanks a lot for your effort and your time.

Abdallah Khaled Elshamy <abdallah_elshamy>
Mon 13 Apr 2020 11:18:43 AM UTC, comment #24: 

I made some modifications and pushed your patch here:
http://hg.savannah.gnu.org/hgweb/octave/rev/d052c11d47c6

Among other things:
I modified some examples to avoid overfull hboxes in the pdf manual.
I changed some error messages. In particular, it might lead to unexpected errors when passing a variable of unknown type into a formatted string.
I'm not sure about the try-catch-block to check if the input is convertible to logical. Those tend to slow down code execution. But I don't know of a better way to do it off hand. So I left it in.
The other changes are minor.

Thanks again for your contribution.
Would you like to be acknowledged as a contributor at the beginning of the manual? Should your middle name or initial be included?

Markus Mützel <mmuetzel>
Group administrator
Sun 29 Mar 2020 08:27:34 PM UTC, comment #23: 


> - I am not sure why you use the xseealso macro instead of the seealso macro that is used in other files.


In the first time, seealso gave me an error while building. It now builds without problems.


I have submitted the patch after modifications.

Please, let me know if there is any problem.

thanks for your time.

(file #48707)

Abdallah Khaled Elshamy <abdallah_elshamy>
Sat 28 Mar 2020 02:43:47 PM UTC, comment #22: 

I had a closer look at this patch again.
Some more points:
- Also remove the new functions from the list in "__unimplemented__.m".
- Try to avoid duplicating code. E.g. do the input parsing first (setting a meaningful default value for IgnoreFlag). Then do the actual comparing (with strncmp or strncmpi, respectively).
- I am not sure why you use the xseealso macro instead of the seealso macro that is used in other files.
- Also, use the correct case in the seealso macros.
- Add a semicolon to the end of lines with function calls even if they don't have a return argument ("error" in particular).
- Would it be possible to use strncmpi to check whether the input is "IgnoreCase" (or the start of it)? Loops tend to be slow in .m files.

Markus Mützel <mmuetzel>
Group administrator
Sun 23 Feb 2020 05:17:01 PM UTC, comment #21: 

I have submitted the patch after modifications

Please, let me know if there is any problem.

thanks for your time.

(file #48483)

Abdallah Khaled Elshamy <abdallah_elshamy>
Sun 23 Feb 2020 11:48:47 AM UTC, comment #20: 

A couple of other things, I didn't notice the first round (mostly nitpicking again):
- Include the bug number in the first line of the commit message.
- Use imperative voice in the commit message to describe what changed.
- Don't override "ans". It has a special meaning in Octave. Use e.g. "retval" or something similar or more meaningful instead.
- When breaking long character vectors at the end of the line, use ellipses and indent the next line accordingly (see e.g. "movie.m" 113).
- Indentation in "if" and "for" blocks is two spaces.
- Have a look at e.g. cellfun and its input "UniformOutput" to get an idea of how "IgnoreCase" could be documented.
- When breaking long lines, indent to after the currently innermost opening bracket if possible.
- Add two spaces in front of "#" for comments on the same line with code.
- There's no need to compress changesets when you upload them here.

Markus Mützel <mmuetzel>
Group administrator
Fri 21 Feb 2020 09:52:34 PM UTC, comment #19: 

I have submitted the patch after modifications

Please, let me know if there is any problem.

thanks for your time.

(file #48468)

Abdallah Khaled Elshamy <abdallah_elshamy>
Fri 21 Feb 2020 08:18:03 PM UTC, comment #18: 


comment #15:

> Also, it is not OK to copy text, including examples, directly from Matlab documentation.


I thought it is better for compatibility. I am very sorry

Abdallah Khaled Elshamy <abdallah_elshamy>
Fri 21 Feb 2020 08:13:10 PM UTC, comment #17: 


comment #15:

> Also, it is not OK to copy text, including examples, directly from Matlab documentation.


thanks for your feedback.

I thought it is okay. I am very sorry for that I will change it in the next patch.

Abdallah Khaled Elshamy <abdallah_elshamy>
Fri 21 Feb 2020 08:11:28 PM UTC, comment #16: 


comment #14:

> Thanks for your contribution.
>
> Just a few nitpicks:
> - The first argument of @deftypefn and @deftypefnx should be empty.
> - Try to use the same input and output argument names in the doc string that you use in the function definition.
> - Usually, we try to start the docstring with a compact one liner that summarizes what the function does.
> - I appreciate the examples in the docstring. But also document in full sentences what all input arguments are supposed to mean.
> - Use a space after "if".
> - Use a space after "!". I was told it should be understood as the English word "not" which would also be followed by a space.
> - Use a space after "##" or "#".
> - Use spaces before and after "=" and in-place operators.
> - Use a space between function names and opening bracket (mostly correct).
> - I don't know if this is a rule. But I usually try to add spaces after commas that separate input arguments of functions.
> - Lines should not be longer than 80 characters.
> - I see many constructs like "size (pattern)(1)*size (pattern)(2)". Would "numel (pattern)" be clearer? Or am I missing something?
> - We usually start claiming copyright in the year the function was written.
>
> Please, don't feel discouraged by the list. Your contribution looks quite good already.



Thanks for your feedback.
I will do these modifications and re-upload it

Abdallah Khaled Elshamy <abdallah_elshamy>
Fri 21 Feb 2020 06:37:26 PM UTC, comment #15: 

Also, it is not OK to copy text, including examples, directly from Matlab documentation.

John W. Eaton <jwe>
Group administrator
Fri 21 Feb 2020 05:17:26 PM UTC, comment #14: 

Thanks for your contribution.

Just a few nitpicks:
- The first argument of @deftypefn and @deftypefnx should be empty.
- Try to use the same input and output argument names in the doc string that you use in the function definition.
- Usually, we try to start the docstring with a compact one liner that summarizes what the function does.
- I appreciate the examples in the docstring. But also document in full sentences what all input arguments are supposed to mean.
- Use a space after "if".
- Use a space after "!". I was told it should be understood as the English word "not" which would also be followed by a space.
- Use a space after "##" or "#".
- Use spaces before and after "=" and in-place operators.
- Use a space between function names and opening bracket (mostly correct).
- I don't know if this is a rule. But I usually try to add spaces after commas that separate input arguments of functions.
- Lines should not be longer than 80 characters.
- I see many constructs like "size (pattern)(1)*size (pattern)(2)". Would "numel (pattern)" be clearer? Or am I missing something?
- We usually start claiming copyright in the year the function was written.

Please, don't feel discouraged by the list. Your contribution looks quite good already.

Markus Mützel <mmuetzel>
Group administrator
Wed 19 Feb 2020 03:16:28 PM UTC, comment #13: 

I have submitted the patch after modifications

Please, let me know if there is any problem

Abdallah Khaled Elshamy <abdallah_elshamy>
Tue 18 Feb 2020 09:10:48 PM UTC, comment #12: 


comment #11:

> Don't modify or add "Makefile.in" to the hg repo. This file is auto generated.
> Use the "module.mk" files in the respective folders instead.



thanks for you time. I really appreciate your help.  
I will create the patch and upload it again.

Abdallah Khaled Elshamy <abdallah_elshamy>
Tue 18 Feb 2020 09:02:38 PM UTC, comment #11: 

Don't modify or add "Makefile.in" to the hg repo. This file is auto generated.
Use the "module.mk" files in the respective folders instead.

Markus Mützel <mmuetzel>
Group administrator
Tue 18 Feb 2020 09:01:18 PM UTC, comment #10: 

The patch looks wrong. it looks to me you are doing diff against the build tree rather than source tree.

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Tue 18 Feb 2020 08:40:00 PM UTC, comment #9: 

I used the simple way in the link you sent me

hg add myfiles
hg ci
hg export -r tip -o startsWith-endsWith.patch
 
I compressed it to fit the savannah limit

Do you suggest another way more suitable?

PS: I finished the batch and built octave on my machine and every thing worked fine. I am ready to submit it.

Abdallah Khaled Elshamy <abdallah_elshamy>
Tue 18 Feb 2020 08:05:27 PM UTC, comment #8: 

How are you creating the patch? A changeset adding one or two .m files should hardly be larger than the limit for attachments on savannah...

Please read e.g. https://wiki.octave.org/Mercurial#Creating_changesets_files_with_hg

Markus Mützel <mmuetzel>
Group administrator
Tue 18 Feb 2020 04:48:36 PM UTC, comment #7: 

unfortunately, bitbucket ended its support for hg repos.

there was problem with the last patch (sent by email).
please ignore it and i will work on a clean one.

can this bug be assigned to me.

thanks for your patience and understanding

Abdallah Khaled Elshamy <abdallah_elshamy>
Tue 18 Feb 2020 04:23:34 PM UTC, comment #6: 

I will use bitbucket to make things easier please ignore my last message

Abdallah Khaled Elshamy <abdallah_elshamy>
Tue 18 Feb 2020 04:06:25 PM UTC, comment #5: 

I noticed that even after choosing a file, the attached file section tells me "No files currently attached" ("I checked that the compressed file under 16 Mega bytes")

I sent the patch file Via gmail on the reply to the automatic email sent by savannah.

Is this okay or should I try again with the bug tracker?

Abdallah Khaled Elshamy <abdallah_elshamy>
Tue 18 Feb 2020 03:19:22 PM UTC, comment #4: 

I don't see any patches in the attachments to this bug report.

Markus Mützel <mmuetzel>
Group administrator
Tue 18 Feb 2020 02:24:15 PM UTC, comment #3: 

I submitted a patch for it. If there is any problem. please, let me know


Abdallah Khaled Elshamy <abdallah_elshamy>
Sat 12 Oct 2019 10:20:12 AM UTC, comment #2: 

There's an "endsWith" to go with it, too. They should probably come in as a set.

https://www.mathworks.com/help/matlab/ref/endswith.html

Andrew Janke <apjanke>
Fri 11 Oct 2019 02:51:58 PM UTC, comment #1: 

This function should be easy to implement as a wrapper around strncmp or strncmpi.

This would be a good project for a first contribution to Octave. [1]

Lowering priority.

[1]: https://wiki.octave.org/Short_projects

Markus Mützel <mmuetzel>
Group administrator
Fri 11 Oct 2019 02:24:48 PM UTC, original submission:  

Matlab Function startsWith https://www.mathworks.com/help/matlab/ref/startswith.html is not available.

amrit karmacharya <amritkarma>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #48445:  startsWith_endsWith.tar.xz added by abdallah_elshamy (143KiB - application/x-xz)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by abdallah_elshamy (Posted a comment)
  • -email is unavailable- added by apjanke (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by amritkarma (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 18 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-04-15 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-04-13 mmuetzel StatusIn Progress Ready For Test
    2020-03-29 abdallah_elshamy Attached File- Added startsWith_endsWith.patch, #48707
    2020-02-23 abdallah_elshamy Attached File- Added startsWith_endsWith.patch, #48483
    2020-02-23 mmuetzel StatusConfirmed In Progress
        SummaryMissing matlab function: startsWith Missing Matlab functions: startsWith and endsWith
    2020-02-21 abdallah_elshamy Attached File- Added startsWith_endsWith.tar.xz, #48468
    2020-02-21 abdallah_elshamy Attached File- Added startsWith_endsWith.tar.xz, #48467
    2020-02-18 abdallah_elshamy Attached File- Added startsWith_endsWith.tar.xz, #48447
    2020-02-18 abdallah_elshamy Attached File- Added startsWith_endsWith.tar.xz, #48445
    2019-10-11 rik5 Carbon-CopyRemoved 72865 -
    2019-10-11 rik5 StatusNone Confirmed
    2019-10-11 mmuetzel Severity3 - Normal 1 - Wish
        Priority5 - Normal 3 - Low
        Item GroupMatlab Compatibility Feature Request
        Release5.1.0 dev
        Operating SystemMicrosoft Windows Any

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code