J'ai une forme avec un pushbutton ou j'ai selecte une image qui me rend en axes. Je veux quand l'image s'affiche en axes son pathname est ecrit automatiquement dans la componente static text.

Donc ma forme a seulement trois composants(1pushbutton avec la methode open dialogue,1 axes et 1 static text).

Si quelqu'un peut m'aider. J'essaye de faire cela et ca ne marche :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
[filename,pathname] = uigetfile({'*.jpg';'*.png';'*.bmp'}); %selecting the file with an open dialog
if ~ischar(filename) %on cancel press function ischar returns 0
    errordlg('Error!','No file selected!'); %appears an error dialog on cancel press
    return;
 end
 
img = imread(fullfile(pathname,filename)); % reading the file stored in path
imshow(img);
imshow(img,'parent',handles.axes1);  %displays image selected in component axes1
%[filename,pathname] =uigetfile('*.jpg');
%img=imread(fullfile(pathname,filename),'jpg');
%
 
%R='C:\MATLAB71\work';
%the code that isn't working storing in static text the path of every file
%loaded in axes1 on pushbutton1 press named Load image
str = get(handles.text1,'string');
str = cellstr(str);
str{end+1} = fullfile(pathname,filename);
set(handles.text1,'string',str); %storing in listbox the path of every image loaded in axes1
load(fullfile(pname,fname),'C:\MATLAB71\work');
set(handles.text1,'String','C:\MATLAB71\work');
J'ai suppose que l'images se trouve dans pathname(chemin):

C:\MATLAB71\work

Si vous pouvez nettoyez pour qu'il stoque automatiquement en static text pathname du photo qui se trouve en axes1(simultanement quand il est mise en axes1 stoquer en static text le chemin complet de la photo selectee que est affiche en axes1). Ca c'est ce que je veux.