# Need help with edit box in matlab gui

2 visualizzazioni (ultimi 30 giorni)
Cristian il 6 Dic 2012
Hi, I have the following matlab code:
if true
h=1/n;
x=h:h:(1-h);
N=(n-1);
A=zeros(N);
b=zeros(N,1);
A=-2*eye(N)+diag(ones(N-1,1),1)+diag(ones(N-1,1),-1);
b=-h.^2.*functie(x);
v=A\b';
plot(v)
end
I take n from an edit box.
The problem is that when I run this code without gui, it works even if n is 5,10,50,100
When i put it in matlab gui, i can give n values from 1 to 9, why is that ?
I am taking the n value like this:
if true
n = get(handles.edit2,'String');
end
Thank you!
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Matt Fig il 6 Dic 2012
n = str2double(get(handles.edit2,'String'));
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Cristian il 6 Dic 2012
Stupid me... works, thank you!

Accedi per commentare.

### Categorie

Scopri di più su Shifting and Sorting Matrices 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