Pre-populate boxes in a prompt window?

7 visualizzazioni (ultimi 30 giorni)
Matt
Matt il 24 Nov 2015
Commentato: Star Strider il 27 Nov 2015
I have only just in the last month or so learnt how to use MATLAB. I'm currently trying to make a basic GUI for a series of race car dynamics calculations.
I'm using questdlg and inside one case, a prompt. User assigns numbers for variables, and the calculations are completed and results displayed in a msgbox. When button is pressed, user is asked if they want to see results on a line graph, then asked if they want to see some other results on a bar chart.
Finally user is asked if they want to change any values. If yes is selected, code steps back to the start of the while loop where the prompt box is created and opened.
I want the boxes in this prompt to contain the numbers they original input, so changing just one and seeing the change in results is easy.
Can I do this? If so, how? I have avoided GUIDE as I want a very short simple script (240 lines inc. comments currently)

Risposta accettata

Star Strider
Star Strider il 25 Nov 2015
I would consider using the listdlg function the second time. It would allow the user to select the variable to be changed, then you could go to perhaps inputdlg to change it, and then continue with your simulation.
There are likely more sophisticated ways to design GUIs to do what you want, but I also generally use the simple ones, since I’m the only one using my applications at present. (If necessary, I would develop a more friendly GUI user interface for anything I submitted to the File Exchange. Just now, none of them need GUIs.)
  11 Commenti
Matt
Matt il 27 Nov 2015
Thanks - I hadn't noticed the paperclip - doh!
What I achieved with the further inputdlg capability of pre-filling the cells I didn't know you could do, but is exactly what I had hope to achieve. I'll send you the code if you care to see... Any suggestions you had looking at it before would be appreciated still - i'm eager to learn.
Hope you had a good Thanksgiving!
Star Strider
Star Strider il 27 Nov 2015
No worries. It’s documented in the Help tab at the top of the page, but not obvious unless you look for it. (The ‘Help’ icon above the text window only deals with markup.)
I would like to see your code when you get it working to your satisfaction. We’re all learning here. Please document it extensively with comments so that I and others (and you if you want to modify it later) can easily understand how it works. I can also learn something about vehicle dynamics.
I did. Thank you!
I had one other thought with respect or your prospective employer. If they’re doing everything with Excel and you know and are proficient with MATLAB, you’ll walk on water there! You’ll have to convince them to buy MATLAB and the necessary toolboxes and Simulink, so also have all the information as to what is necessary and the costs and licensing options at hand when you interview. Contact MathWorks directly and ask them for the details.
And explore the xlsread and related functions when you have the opportunity. Looks as though you’ll be using them often!

Accedi per commentare.

Più risposte (1)

Image Analyst
Image Analyst il 25 Nov 2015
Don't be afraid of GUIDE. It's not that hard and can make some things easier. Perhaps you'd like to get started with this easy-to-use generic framework. http://www.mathworks.com/matlabcentral/fileexchange/24224-magic-matlab-generic-imaging-component
Description This GUI will help the novice user get up to speed very quickly on using GUI-based applications. Everything is laid out in a very simple Step 1, Step 2, Step 3, etc. layout. It is a very good starting point for a typical image analysis application. This application uses GUIDE to do the user interface design, and has most of the basic controls such as buttons, listboxes, checkboxes, radio buttons, scrollbars, etc. It allows the user to select a folder of images, select one or more images and display them, to select a series of options, and to individually or batch process one or more images. The user can
  4 Commenti
Image Analyst
Image Analyst il 26 Nov 2015
You haven't shown much - probably not the full code. But what little I see, as an employer, is simple, primitive code. I see someone who just wanted to do something quick and dirty to get an answer but really wasn't interested in writing professional code worthy of selling to the general public or my customers. Could you write a professional program - something with the GUI sophistication of Word, Excel, Powerpoint, or Photoshop? Who know - maybe you can and maybe you can't. I would not be able to determine that from the snippet you gave. I certainly would not be impressed at that code, at least not enough to hire you based on your ability to write robust professional looking software - there's just nothing there to demonstrate that. Graphic designers, artists, and fashion designers have portfolios of their work - illustrations of what they've designed. Do you have that? I'd maybe be impressed if you showed me 20 screenshots of GUIs of different programs that you designed. Or if you could tell me that you have 6,000 users of your application, or that you have 8 applications for sale to the general public - something like that.
When I hired an image processing Ph.D. we looked at dozens of resumes, telephone interviewed about a dozen, and brought in 3 or 4, and ultimately hired one. They all said they knew MATLAB. One even said that he taught MATLAB. So I asked them all a simple question. I said I had a white substrate with dark stain on it and different images had different amounts of stain cleared away, so their area fractions were different. I told them I wanted to know the area fraction of white and dark, and I had good control over the lighting. I asked them how they would do it in MATLAB. This is about as basic as you can get. You'd be surprised how many or them could not solve the problem. Some of them didn't even know about regionprops() - which is THE number one main function of the entire Image Processing Toolbox. Most of them came up with wrong algorithms - nonsense like graythresh(), etc. And these were Ph.D.s who were supposed to be MATLAB experts. Only one got the right answer and that was with me throwing a few hints his way.
Matt
Matt il 26 Nov 2015
Modificato: Matt il 26 Nov 2015
Thanks for your advice. I have it working now, but it would be more efficient with everything stored in an array I could refer the code to various cells (values and names) at different times.
It is a university piece of coursework, where I have met the requirements and started from no MATLAB experience. The employer I want to impress is a small engineering outfit who currently use Excel, and have little/no experience with MATLAB, but carry out similar calculations within Excel.
I fully understand and appreciate what you are saying but I am not going for a job as a programmer, but instead a vehicle dynamics engineer.
In time I will play with GUIDE and look to make this script more efficient, but for now it works as it needs to, and owes me too much time!

Accedi per commentare.

Categorie

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by