|
Hello all I've got a problem that I've been unable to find a solution to. I'm trying to display a table in a way that is easy to read part way though a function.
I have generated a table which shows the user what changes are going to be made to a simulink model, I’m then providing the user with a menu to select if they want to apply, save to csv or discard the suggested changes. Originally I was displaying the table in the console using the disp command but it tends to wrap round on to the next line and can be very difficult to actually see.
I then discovered the openvar command (which opens the cell table in the array editor - like double clicking on it in the workspace does), however this only seems to work for variables in the console workspace, I worked around that by using assignin (which isn't the most elegant approach). I was also thinking that the user might even be able to edit the variable in the array editor before selecting the menu option, which would have been really good. This would be fine except the input command that follows (to provide the menu) seems to make the array editor hang before it's opened the variable, meaning that you can't see the table. I've tried inserting wait functions and using evalin but nothing seems to work. Once the function exits the table does finish opening in the editor.
I know you can create a gui using guide and use uitable in the newer versions of matlab which I assume would be a better solution, however I am using R2007a which doesn't have uitable, does anyone know a good way to achieve this? Is there a command to refresh the array editor in some way that might help? Or is there a simple way to write tables to the command line without them wrapping that anyone knows of or will I need to write my own function?
Below is an example that I've been working with to try and get the openvar approach to work:
function test
output = {'This' 'is' 'a' 'cell' 'array' 'table'};
assignin('base','CorrectionsToModel', output);
openvar('CorrectionsToModel')
%also tried: evalin('base','openvar(''CorrectionsToModel'')')
theinput = input('Please Enter Input');
Thanks in advance for any help anyone can provide.
|