MATLAB Answers

Specify What to Edit for User

1 view (last 30 days)
Ephraim Bryski
Ephraim Bryski on 10 Jul 2019
Edited: per isakson on 30 Jul 2019
I'm writing code which should allow the user to edit certain sections, and I want to make it clear to the user where they should edit (it doesn't have to prevent them from editing other stuff). The user would select what they want to modify in the code (through a GUI) and it would take them to the correct section of the code. I thought of a number of options (unfolding only that section, disabling editing other code, moving to the correct line) but I couldn't find a command to do any of these things. (Having it display something in line through live editor won't work because it's a class). Does anyone know how you might implement this?


Ephraim Bryski
Ephraim Bryski on 12 Jul 2019
Yes, that is exactly what I meant. I'm still very new to this, so my terminology is pretty lousy. When I say variable name I meant any thing where you would say
(my idea of variable name)=(something)
I realize that's not correct now though.
This is a very specific question, but important for me and may help me improve the overall code. I'm supposed to make an animation, but when I run it it's incredibly slow now that I've implemented it (like it would take hours to finish slow). I made inputs to the function where all the inputs are handles (to clarify:
if I were to type the input into the command window it would give:
(my_input)=(something (cell array, matrix whatever))
so inputting it should NOT
require it to access the class. I'm not sure what is causing it to be slow (but I'm supposed to update the animation -- change the annotation a bit -- and show it to the mentor today) so I really need to figure out what could be wrong. Saying my program causes it to be really slow wouldn't be that good.
Ephraim Bryski
Ephraim Bryski on 12 Jul 2019
So I think the idea is I would create the API and the user would basically have to learn how to use it. There would documentation they could get with help (some name of my function) and it would throw things like warnings or errors if they're not using it properly (the API would somehow have to know what the users trying to do and decide if it's ok).
I think I'm going to save some new code which doesn't have any of the specifics for my project (so you don't have to look through hundreds of irrelevant lines of code) add some very basic documentation (at least some stuff you could access with help) and upload it to an opensource forum. Then I'll add the link here and anyone who wants to can edit it. I think I'll keep the GUI but the first step might be getting rid of it. Hopefully I'll have it uploaded by Monday or so.
I do want to make this specific for water related stuff (things like experiments where waves impact objects) so certain specific code (like calculating uplift from pressure gauges) would also be uploaded.
Ephraim Bryski
Ephraim Bryski on 13 Jul 2019
I thought about all this and I described how the api should work here. I still have to learn a bit more I think before I start coding (things like handle functions, handle functions as inputs, assert). I also don't know how good my basic idea so far is.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 12 Jul 2019
I'd just use app designer or guide and make a gui with either 3 radio buttons or a drop down list (popup) with three selections. Then in the main part of your code, you can check the state of the GUI controls to see which of your available options they selected.


Show 1 older comment
Ephraim Bryski
Ephraim Bryski on 12 Jul 2019
I think my initial question was not very clear. However Guillaume started a comment in which we discuss it in more detail.
Image Analyst
Image Analyst on 13 Jul 2019
I still think you're making it way more complicated than necessary by doing such low level API coding manually.
Ephraim Bryski
Ephraim Bryski on 13 Jul 2019
If you're referring to the GUI, I decided the first thing I'll do is get rid of it.

Sign in to comment.





Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!