transformer string en handle graphique
Bonjour,
Comment transformer un string en handle graphique ? Le problème se pose dans le programme suivant:
Code:
1 2 3 4 5 6 7 8 9
|
% Fonction de contrôle des chiffres rentrés dans la grille
function controle(horiz,vert)
global MAT
data = guidata(gcbf);
spec_h=['data.tag_sq' num2str((horiz-1)*9+vert)];
MAT(vert,horiz)=str2double(get(spec_h,'string')); |
spec_h représente (au format string) le handle qui doit être appelé dans ce cas. Le réutiliser tel quel dans la fonction "get" provoque l'erreur suivante:
Code:
1 2 3 4 5 6 7 8
|
??? Error using ==> get
Invalid handle
Error in ==> controle at 8
MAT(vert,horiz)=str2double(get(spec_h,'string'));
??? Error while evaluating uicontrol Callback |
J'ai essayé la fonction str2func mais cela ne marche pas dans ce cas. C'est manifestement réservé aux function handles.
Par avance, merci
Luis