oro777
oro777

Reputation: 1110

Multiple imline and wait in MATLAB

I am trying to figure out how imline(Image Processing Toolbox) works in MATLAB 2017a with the wait command. I have created a simple example. The code works but depending on the user operation, it fails.

I want to trace two lines using imline. Using the wait command I can change the line position before resuming the program. After tracing the first one, I double-click to confirm the position, then by right-clicking I display the menu and delete the trace. Using imline once more, I trace a new line but an error occurs. (bad handle inside the imline subfunctions)

Here is my code.

ha = axes;
hl = imline( ha );
wait( hl );
hl2 = imline( ha );
wait( hl2 );

The second call of imline should not have any influence on the first one. Is there an issue with imline?

N.B : If I do not double-click to confirm the position, it works as expected.

Upvotes: 1

Views: 133

Answers (1)

EBH
EBH

Reputation: 10450

As the OP wrote in comments, the error only occurs if he deletes the first line after he starts to draw the second line (i.e. the cursor is set to + again).

This error is not related to the wait command. Even with the following code the error apears:

ha = axes;
hl = imline(ha);
% try to delete the first line before drawing the second
hl2 = imline(ha);

So the user must not delete a line while drawing another line (i.e. when the cursor is set to +).

However, since the user can edit the lines after he creates them, there is no real need for this functionality. The user can draw bothe lines and then edit them as he wishes.

If you want the user to be able to delete lines before drawing new ones, then you can add a wait, but the user can delete the first line as long as he did not confirm it (with double click on it).

Upvotes: 1

Related Questions