imwrite can't open file

5 次查看(过去 30 天)
bruno
bruno 2013-7-18

I have this code as testImage.m :

vectImage=char('AAAESO');
[mv,nv]=size(vectImage);
for k=1:mv
    X=imread(['../convert/' strtrim(vectImage(k,:)) '.png']);
    imwrite(X,['../segmentation/imagesPreditesDesequilibre3class/toto.tif'],'tif');
end

when i run it on my ubuntu 12.04, 64 bits using this :

nohup matlab -nosplash -nodisplay < testImage.m > output.txt &

i got this error written in output.txt :

Error using imwrite (line463) Can't open file "../segmentation/imagesPreditesDesequilibre3class/toto.tif" for writing. You may not have write permission.

I have write permission...

So I write only matlab, the prompt appears and i run testImage :

>> testImage
Error using imwrite (line 463)
Can't open file "../segmentation/imagesPreditesDesequilibre3class/toto.tif" for writing.
You may not have write permission.
Error in testImage (line 10)
      imwrite(X,['../segmentation/imagesPreditesDesequilibre3class/toto.tif'],'tif');

I copy paste my line 10

>>imwrite(X,['../segmentation/imagesPreditesDesequilibre3class/toto.tif'],'tif');
>>

and it works...

When i run the same code on my windows 7 it works properly. I don't know where this error comes from since i use a similar code to write images that is perfectly working on my ubuntu. I really need to run this code on my linux by using the first command. Do you have a solution ?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by