mirdata | Python library for working with Music Information Retrieval | Dataset library
kandi X-RAY | mirdata Summary
kandi X-RAY | mirdata Summary
common loaders for Music Information Retrieval (MIR) datasets. Find the API documentation here.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Convert to jams format
- Convert event data to Jambox
- Convert chord data to jamodata
- Convert beat data to jamodata
- Create a dataset index for the audio data directory
- Return a dict of attributes from a hdf5 file
- Load key data from file
- Format key string
- Make the beatles index
- Make filosax indexes
- Create an index for aQueen
- Create an index for a given vocabulary
- Make an index for salami
- Convert to a multiF0Data object
- Create a dacos index file
- Validate confidence
- Create an index for the RBC classification
- Creates an index for a given dataset
- Load the Multif0Data from a MIDI file
- Creates an index for aaraga dataset
- Create a popular index
- Download a dataset
- Make an index for the RBC Jazz
- Create a pandas index
- Create a jingju index
- Creates a dictionary of irmas index
mirdata Key Features
mirdata Examples and Code Snippets
Community Discussions
Trending Discussions on mirdata
QUESTION
I have a "Next" button that runs the following code. It copies the contents of the next (below) row of the source range and pastes it to a cell in the destination sheet.
I would also like to have similar code that is run by a "Previous" button which copy/pastes the contents of the previous row (above) instead.
I tried - 1
instead of + 1
, but that didn't work.
Can someone here help me to modify the code to correctly create a "Previous" button?
...ANSWER
Answered 2018-Dec-10 at 01:25That code was written (by me) for the specific case where there is only a Next button.
It would seem that changing the first + 1
to - 1
would be the way to modify the code to create a Previous button. This sort of works, but has a couple of issues which will be explained shortly. Before getting to that, however, note that the second + 1
must remain unchanged. It is there simply to convert the zero-base stored index to a one-base index as required by the Cell
property. (And yes, for the Next button only case, it would have been simpler to store the one-base index instead. Fortuitously, storing the zero-based index turns out to be the simplest method for the case of both Next and Previous buttons.)
So, what are the issues with the - 1
?
Well firstly, whilst it will correctly update the index to point to the previous row of the source range, it fails to wrap from the first row of the range to the last row. Instead, it results in a 1004
error (as .Cells(sidxCurrentCell + 1).Copy
evaluates to .Cells(0).Copy
). This is because the assignment statement containing the Mod
operator was written in the simplest way to wrap from the last row to the first row, without allowing for the reverse case.
Secondly, since the current index is stored as a static variable in the subroutine called when a button is pressed, having two such subroutines means that there are two stored indexes operating independently of each other. Thus, assuming the indexes are both set to the second row, the sequence of button presses, Next+Next+Previous, will not result in displaying the third row's value, but will instead show the first row's value.
To solve the first issue, you need to add the number of rows of the source range to the first operand of the Mod
operator. (Note that with this modification the Next subroutine will also continue to work correctly.)
The second issue is solved by using a generalised Previous/Next subroutine which takes a parameter to determine the direction, and assigning two other separate subroutines to each button respectively. These helper subroutines just call the main routine with the appropriate argument value (1
for the Next button and -1
for the Previous button). Thus, there is only one stored index which is used by both buttons.
The following is the full modified code where Button1
is the Next button, and Button2
is the Previous button:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mirdata
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page