Whats wrong with tester_app_3?

1 visualización (últimos 30 días)
Muazma Ali
Muazma Ali el 3 de Mzo. de 2024
Comentada: Muazma Ali el 8 de Jul. de 2024
I am not sending the functions that are needed to run the app and neither the other app required to run the app since they are many functions and the problem is in tester_app_3.
Do I need a while loop somewhere?
Seems the values for the table osmotic data aren’t saved in my table columns when I run the app?
I think there is something missing in tester_app_3 which I can’t see.
Do I need a loop to accumulate the column values in osmotic data, I just get the last value printed. It also seems that the program doesn’t start on zone nr 1 when I start the app again though I have deleted the previous files by writing the syntax delete(file).
I have matlab 2018
  8 comentarios
Muazma Ali
Muazma Ali el 19 de Mzo. de 2024
sorry probably I forgot to attach all the files that were needed.
I will try again later, :)
Muazma Ali
Muazma Ali el 20 de Mzo. de 2024
Hi again! :)
And sorry for the confusion; now all the right files for the test version are included in the zip file,
I am not pasting the description of the problem but the problems are the same as described above
Thanks for helping me

Iniciar sesión para comentar.

Respuesta aceptada

Voss
Voss el 20 de Mzo. de 2024
In order to fix the problems you're having, it is necessary to redesign the code significantly.
I gather that your intent is to run tester_app_3 for each zone, and collect the results in a single table. To do that, I made the table Osmotisk_data a property of tester_app2 (i.e., the main app), and removed the reliance on writing and reading the xls file (you can add a new button to write the file if desired).
Each time tester_app_3 is complete (by clicking on the Done button - formerly the Exit button), the zone_now property of tester_app2 is incremented so that the next call to tester_app_3 updates the correct row of the table. This was the essential logic missing in your original design.
See the attached zip containing the updated files. All mlapp files were modified, but no m files were modified.
I tried to keep your existing logic the same as much as possible, though I did add some new error-checking including disabling buttons to prevent entry into the next step with invalid parameters (and enabling them when the parameters are valid). I'm not going to claim that the program is now 100% robust, but it should be an improvement.
Some general advice for the future:
  • Do not to make a variable an app property unless it's necessary to do so. Generally it's only necessary if that variable needs to be shared among multiple apps (in which case it must be a public property) or multiple functions within one app (in which case it can be a private property). I found that most of your app properties were really only needed in one function, so those have been made into local variables in the function where they are used. You can see the list of app properties now to get an idea of the very few really necessary app properties in each app, and understand why those particular things need to be app properties.
  • Error-check and validate a variable value before storing it as an app property. It makes your programming job easier if you know your app properties are always valid (and consistent with each other).
  • In general, think about what the program needs to do when the user entered something invalid. Arguably more important than (as least equally as important as) doing the right thing when a good value is entered is not doing the wrong thing (i.e., crashing / generating an uncaught error) when a bad value is entered. In designing GUIs you have to give plenty of thought to all the bad states the program can get into, not only the one good state where everything is fine.
Let me know if you have any trouble opening the mlapp files in your version of appdesigner. Sources I've found online seem to suggest there should be no compatibility issues between R2022a (what I used to save them) and your version (R2018a or R2018b), but if there are issues, let me know.
  16 comentarios
Muazma Ali
Muazma Ali el 7 de Jul. de 2024
@Voss Thanks Voss! :)
I will try now and implement your suggestion to have all results button procedures in one app, and having these on the same window as app2
Muazma Ali
Muazma Ali el 8 de Jul. de 2024
@Voss Hi Voss ! :)
I have now made some changes; now all the results button are in the primary app , tester_app_2.
But I have a problem; I dont want the 'results of the analysis' button to appear before all the analysis are done. I have done it so all the results buttons in the panel are hidden before we push the 'results of the analysis' button.
Thanks for helping me

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by