3

As has been discussed in this question, you can override Matlab's default behaviors when dragging files into Matlab's Command window. The key is to override the openXXX function.

When you drag a file into the Matlab workspace window, if it's an image type, that Matlab knows about, it will load the file as an image. If it's image file it doesn't know about, Matlab will load it as a text file. How does one "teach" Matlab to load image formats it doesn't know about, into the workspace window?

John
  • 5,735
  • 3
  • 46
  • 62
  • writting your image reading function. The fact that its an image doesnt meman its not compressed, e.g. jpg. You can't just read bytes and assume they are pixels, if the format is unknown. – Ander Biguri Feb 06 '18 at 16:00
  • 1
    I feel like this is already covered in the answers to the linked question. – gnovice Feb 06 '18 at 16:02
  • @gnovice, nope, command window yes, but workspace window nope. – John Feb 06 '18 at 16:03
  • @AnderBiguri I have the functions that read the images, but how to plug that into matlab, so it knows to use those functions when I drag and drop the associated files into the workspace is the question. – John Feb 06 '18 at 16:04
  • While I am not sure how matlab works under the hood, the actual effect of droping the files in workspace or commadn window is the same. Why don't you just drop in in command window? – Ander Biguri Feb 06 '18 at 16:07
  • 1
    @AnderBiguri you are correct, that one can drag into the command window, and that is a work around to this problem. But if I can overload the command window dropping, I should be able to overload the workspace window dropping. How? – John Feb 06 '18 at 16:48
  • No idea. Good luck! – Ander Biguri Feb 06 '18 at 16:49
  • @John "I can overload the command window dropping, I should be able to overload the workspace window dropping" - this conclusion is wrong. The solution to the linked question takes advantage of standard function overloading, this is common practise when building classes etc. Changing the workspace behaviour is likely changing some callback within the MATLAB IDE - a completely different kettle of fish as there is no function being called. – Wolfie Feb 06 '18 at 17:00

0 Answers0