MATLAB Easy MATLAB Graphics: Plot, Change Linewidth and Linestyle

  • Thread starter Thread starter Kontilera
  • Start date Start date
  • Tags Tags
    Graphics Matlab
AI Thread Summary
The discussion revolves around creating a MATLAB program that allows users to plot graphs and customize their appearance, specifically by changing the linewidth and linestyle. The user has successfully implemented dialog windows and a plotting loop but is encountering issues when trying to update the linewidth of a specified figure. The provided code attempts to retrieve the figure ID and desired linewidth from user input, but it fails to update the graph as intended. The user is seeking advice on how to resolve this issue, particularly regarding the proper handling of figure IDs and linewidth settings in MATLAB. Key points include the need to ensure that the inputs are correctly parsed and that the `set` function is used appropriately to modify the properties of the specified figure.
Kontilera
Messages
176
Reaction score
24
Hello! I'm trying to make an easy MATLAB programme in which you can plot your graphs, change the linewidth, and linestyle in the graphs you want etc.
I've managed to use to dialog windows in MATLAB and write a loop which plots a given function. Now I want the programme to ask the user for the figureid and the linewidth and then make the corresponding change.. Here I run into trouble.

My code for this specific m-file is:

Code:
function outt = changewidth(handles)  

Figureid = input('Which figure would you like to change: ');
Width = input('Which width would you like to have: ','s');

z = str2num('Figureid');
p = str2num('Width');


figure(Figureid);
set(z, 'Linewidth', p);

outt=[handles];
end

I don't get any error message but MATLAB won't update the graph that the user refers to..

Any advice?
 
Physics news on Phys.org
In my mainfile I just write:

Code:
[...]

case 2 

changewidth(handles)


case 3 
[...]


end
 

Similar threads

Replies
2
Views
3K
Replies
1
Views
2K
Replies
9
Views
5K
Replies
1
Views
4K
Replies
4
Views
2K
Replies
3
Views
2K
Back
Top