Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Detecting System Drive ( urgent help )

Subject: Detecting System Drive ( urgent help )

From: Mamata Kukreja

Date: 15 Feb, 2008 02:18:01

Message: 1 of 13

Hello,

I want to read images from an external source eg mobile ..
how to read is clear but how do we detect the system drive
.. ie wen i connect the data cable .. how to detect whether
its E: or F: or watever differing from system to system.

Configuring the USB port ??

Subject: Re: Detecting System Drive ( urgent help )

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 15 Feb, 2008 03:18:46

Message: 2 of 13

In article <fp2sop$hsl$1@fred.mathworks.com>,
Mamata Kukreja <mamata_kukreja@yahoo.com> wrote:

>I want to read images from an external source eg mobile ..
>how to read is clear but how do we detect the system drive
>.. ie wen i connect the data cable .. how to detect whether
>its E: or F: or watever differing from system to system.

>Configuring the USB port ??

Your question is outside of the reach of Matlab. Matlab does
not recognize "system drives". (Matlab currently runs on
four operating systems, three of which do not have such a
thing as a "system drive".)
--
  "Pray do not take the pains / To set me right. /
   In vain my faults ye quote; / I wrote as others wrote /
   On Sunium's hight." -- Walter Savage Landor

Subject: Re: Detecting System Drive ( urgent help )

From: Mamata Kukreja

Date: 15 Feb, 2008 03:43:01

Message: 3 of 13

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <fp30am$ljd$1@canopus.cc.umanitoba.ca>...
> In article <fp2sop$hsl$1@fred.mathworks.com>,
> Mamata Kukreja <mamata_kukreja@yahoo.com> wrote:
>
> >I want to read images from an external source eg mobile ..
> >how to read is clear but how do we detect the system drive
> >.. ie wen i connect the data cable .. how to detect whether
> >its E: or F: or watever differing from system to system.
>
> >Configuring the USB port ??
>
> Your question is outside of the reach of Matlab. Matlab does
> not recognize "system drives". (Matlab currently runs on
> four operating systems, three of which do not have such a
> thing as a "system drive".)
> --
> "Pray do not take the pains / To set me right. /
> In vain my faults ye quote; / I wrote as others wrote /
> On Sunium's hight." -- Walter
Savage Landor


But there should be some solution to reading images from an
external device .. some command or function .. if i had a
digital photo keychain .. and want to insert images in it or
read fromn the SD card .. ??

Subject: Re: Detecting System Drive ( urgent help )

From: us

Date: 15 Feb, 2008 08:02:04

Message: 4 of 13

"Mamata Kukreja":
<SNIP looking for his/her disks...

> how to detect whether
> its E: or F:
> or watever differing from system to system...

one of the (imcomplete) solutions (on winos')

% get the list of current drives
     import java.io.*;
     f=File('');
     r=f.listRoots;
for i=1:numel(r)
     disp(sprintf('%s',char(r(i))));
end
% now you'd have to check each one for the
% contents you're looking for, eg,
     dir(char(r(1)));

us



Subject: Re: Detecting System Drive ( urgent help )

From: Vihang Patil

Date: 15 Feb, 2008 09:05:03

Message: 5 of 13

"us " <us@neurol.unizh.ch> wrote in message
<fp3gts$8bc$1@fred.mathworks.com>...
> "Mamata Kukreja":
> <SNIP looking for his/her disks...
>
> > how to detect whether
> > its E: or F:
> > or watever differing from system to system...
>
> one of the (imcomplete) solutions (on winos')
>
> % get the list of current drives
> import java.io.*;
> f=File('');
> r=f.listRoots;
> for i=1:numel(r)
> disp(sprintf('%s',char(r(i))));
> end
> % now you'd have to check each one for the
> % contents you're looking for, eg,
> dir(char(r(1)));
>
> us
>
>
>


There is a freeware called USBDeview found here
http://www.nirsoft.net/utils/usb_devices_view.html

This freeware looks for all USB devices on your PC. It
also has command interface, where you can populate the
results in a text, excel , xml file etc, and then read the
file through Matlab
Lot of R&D would be required at your end.
HTH
Vihang


Subject: Re: Detecting System Drive ( urgent help )

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 15 Feb, 2008 15:28:46

Message: 6 of 13

In article <fp31o5$jq0$1@fred.mathworks.com>,
Mamata Kukreja <mamata_kukreja@yahoo.com> wrote:
>roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
>message <fp30am$ljd$1@canopus.cc.umanitoba.ca>...
>> In article <fp2sop$hsl$1@fred.mathworks.com>,
>> Mamata Kukreja <mamata_kukreja@yahoo.com> wrote:

>> >I want to read images from an external source eg mobile ..
>> >how to read is clear but how do we detect the system drive
>> >.. ie wen i connect the data cable .. how to detect whether
>> >its E: or F: or watever differing from system to system.

>> Your question is outside of the reach of Matlab.

>But there should be some solution to reading images from an
>external device .. some command or function .. if i had a
>digital photo keychain .. and want to insert images in it or
>read fromn the SD card .. ??

Matlab is not a systems programming language. There doesn't have to
be a solution to any hardware problem within Matlab itself.

Thought experiment: if you were to take the keychain and copy
its contents to another keychain, and then were to put both on the
same system, then how are you going to identify which is the "right"
device? Not by the contents. Therefore you are going to have to
examine the system information tables or make system calls in order
to find out the device serial numbers and compare them to the one
you know to be the right one. This duplication of a device might
sound unlikely, but consider this: on my PC, I can put a camera memory
stick into my printer and have it mounted as a USB drive, and I
can also connect up my camera to the PC and have that mounted as
a USB drive. Which is the right drive? As long as you are trying
to detect the drive automatically instead of asking the user,
you need to track device serial numbers. If you don't know
the device serial numbers ahead of time, it is logicaly impossible
to figure out which of several substantially similar drives is
the right one. Unless, that is, that the key to this is that it
must be the one that was most recently inserted or which must be
inserted while the program is already running.

Poking on my PC a bit, I see that possibly looking in the
registry at HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\DosDevices
might help to find out which drives are there. There is an entry
for each drive letter.
--
  "Man's life is but a jest,
   A dream, a shadow, bubble, air, a vapor at the best."
                                         -- George Walter Thornbury

Subject: Re: Detecting System Drive ( urgent help )

From: Mamata Kukreja

Date: 05 May, 2008 06:41:04

Message: 7 of 13

"us " <us@neurol.unizh.ch> wrote in message
<fp3gts$8bc$1@fred.mathworks.com>...
> "Mamata Kukreja":
> <SNIP looking for his/her disks...
>
> > how to detect whether
> > its E: or F:
> > or watever differing from system to system...
>
> one of the (imcomplete) solutions (on winos')
>
> % get the list of current drives
> import java.io.*;
> f=File('');
> r=f.listRoots;
> for i=1:numel(r)
> disp(sprintf('%s',char(r(i))));
> end
> % now you'd have to check each one for the
> % contents you're looking for, eg,
> dir(char(r(1)));
>
> us
>
> ERROR:

??? Undefined command/function 'toChar'.

Error in ==> opaque.char at 94
    chr = toChar(opaque_array(1));

Error in ==> untitled at 6
     disp(sprintf('%s',char(r(i))));
>

Subject: Re: Detecting System Drive ( urgent help )

From: Mamata Kukreja

Date: 05 May, 2008 06:45:05

Message: 8 of 13

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <fp4b3e$csc$1@canopus.cc.umanitoba.ca>...
> In article <fp31o5$jq0$1@fred.mathworks.com>,
> Mamata Kukreja <mamata_kukreja@yahoo.com> wrote:
> >roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
> >message <fp30am$ljd$1@canopus.cc.umanitoba.ca>...
> >> In article <fp2sop$hsl$1@fred.mathworks.com>,
> >> Mamata Kukreja <mamata_kukreja@yahoo.com> wrote:
>
> >> >I want to read images from an external source eg
mobile ..
> >> >how to read is clear but how do we detect the system drive
> >> >.. ie wen i connect the data cable .. how to detect
whether
> >> >its E: or F: or watever differing from system to system.
>
> >> Your question is outside of the reach of Matlab.
>
> >But there should be some solution to reading images from an
> >external device .. some command or function .. if i had a
> >digital photo keychain .. and want to insert images in it or
> >read fromn the SD card .. ??
>
> Matlab is not a systems programming language. There
doesn't have to
> be a solution to any hardware problem within Matlab itself.
>
> Thought experiment: if you were to take the keychain and copy
> its contents to another keychain, and then were to put
both on the
> same system, then how are you going to identify which is
the "right"
> device? Not by the contents. Therefore you are going to
have to
> examine the system information tables or make system calls
in order
> to find out the device serial numbers and compare them to
the one
> you know to be the right one. This duplication of a device
might
> sound unlikely, but consider this: on my PC, I can put a
camera memory
> stick into my printer and have it mounted as a USB drive,
and I
> can also connect up my camera to the PC and have that
mounted as
> a USB drive. Which is the right drive? As long as you are
trying
> to detect the drive automatically instead of asking the user,
> you need to track device serial numbers. If you don't know
> the device serial numbers ahead of time, it is logicaly
impossible
> to figure out which of several substantially similar drives is
> the right one. Unless, that is, that the key to this is
that it
> must be the one that was most recently inserted or which
must be
> inserted while the program is already running.
>
> Poking on my PC a bit, I see that possibly looking in the
> registry at
HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\DosDevices
> might help to find out which drives are there. There is an
entry
> for each drive letter.
> --
> "Man's life is but a jest,
> A dream, a shadow, bubble, air, a vapor at the best."
> -- George Walter
Thornbury


-----------------------------------------------------------

% get the list of current drives
     import java.io.*;
     f=File('');
     r=f.listRoots;
for i=1:numel(r)
     disp(sprintf('%s',char(r(i))));
end
% now you'd have to check each one for the
% contents you're looking for, eg,
     dir(char(r(1)));


ERROR::
??? Undefined command/function 'toChar'.

Error in ==> opaque.char at 94
    chr = toChar(opaque_array(1));

Error in ==> untitled at 6
     disp(sprintf('%s',char(r(i))));

Subject: Re: Detecting System Drive ( urgent help )

From: helper

Date: 05 May, 2008 07:57:03

Message: 9 of 13

"Mamata Kukreja" <mamata_kukreja@yahoo.com> wrote in
message <fvmadh$163$1@fred.mathworks.com>...

> ERROR::
> ??? Undefined command/function 'toChar'.
>
> Error in ==> opaque.char at 94
> chr = toChar(opaque_array(1));
>
> Error in ==> untitled at 6
> disp(sprintf('%s',char(r(i))));


Interesting. This works on my computer. What does the
output of the following command return?

which -all toChar

Subject: Re: Detecting System Drive ( urgent help )

From: helper

Date: 05 May, 2008 08:02:56

Message: 10 of 13

"helper " <spamless@nospam.com> wrote in message <fvmeke$p47
$1@fred.mathworks.com>...
> "Mamata Kukreja" <mamata_kukreja@yahoo.com> wrote in
> message <fvmadh$163$1@fred.mathworks.com>...
>
> > ERROR::
> > ??? Undefined command/function 'toChar'.
> >
> > Error in ==> opaque.char at 94
> > chr = toChar(opaque_array(1));
> >
> > Error in ==> untitled at 6
> > disp(sprintf('%s',char(r(i))));
>
>
> Interesting. This works on my computer. What does the
> output of the following command return?
>
> which -all toChar


Also, what does the output of this command return?

version -java

Subject: Re: Detecting System Drive ( urgent help )

From: Mamata Kukreja

Date: 05 May, 2008 10:07:05

Message: 11 of 13

"helper " <spamless@nospam.com> wrote in message
<fvmevg$g5c$1@fred.mathworks.com>...
> "helper " <spamless@nospam.com> wrote in message <fvmeke$p47
> $1@fred.mathworks.com>...
> > "Mamata Kukreja" <mamata_kukreja@yahoo.com> wrote in
> > message <fvmadh$163$1@fred.mathworks.com>...
> >
> > > ERROR::
> > > ??? Undefined command/function 'toChar'.
> > >
> > > Error in ==> opaque.char at 94
> > > chr = toChar(opaque_array(1));
> > >
> > > Error in ==> untitled at 6
> > > disp(sprintf('%s',char(r(i))));
> >
> >
> > Interesting. This works on my computer. What does the
> > output of the following command return?
> >
> > which -all toChar
>
>
> Also, what does the output of this command return?
>
> version -java
-------------------------------------------------------

>> which -all toChar
'toChar' not found.

>> version -java

ans =

Java 1.4.2 with Sun Microsystems Inc. Java HotSpot(TM) Client VM
    (mixed mode)

Subject: Re: Detecting System Drive ( urgent help )

From: Mamata Kukreja

Date: 06 May, 2008 14:44:04

Message: 12 of 13

"Mamata Kukreja" <mamata_kukreja@yahoo.com> wrote in message
<fvmm89$fcs$1@fred.mathworks.com>...
> "helper " <spamless@nospam.com> wrote in message
> <fvmevg$g5c$1@fred.mathworks.com>...
> > "helper " <spamless@nospam.com> wrote in message <fvmeke$p47
> > $1@fred.mathworks.com>...
> > > "Mamata Kukreja" <mamata_kukreja@yahoo.com> wrote in
> > > message <fvmadh$163$1@fred.mathworks.com>...
> > >
> > > > ERROR::
> > > > ??? Undefined command/function 'toChar'.
> > > >
> > > > Error in ==> opaque.char at 94
> > > > chr = toChar(opaque_array(1));
> > > >
> > > > Error in ==> untitled at 6
> > > > disp(sprintf('%s',char(r(i))));
> > >
> > >
> > > Interesting. This works on my computer. What does the
> > > output of the following command return?
> > >
> > > which -all toChar
> >
> >
> > Also, what does the output of this command return?
> >
> > version -java
> -------------------------------------------------------
>
> >> which -all toChar
> 'toChar' not found.
>
> >> version -java
>
> ans =
>
> Java 1.4.2 with Sun Microsystems Inc. Java HotSpot(TM)
Client VM
> (mixed mode)



????

Subject: Re: Detecting System Drive ( urgent help )

From: helper

Date: 07 May, 2008 00:02:03

Message: 13 of 13

> >> which -all toChar
> 'toChar' not found.
>
> >> version -java
>
> ans =
>
> Java 1.4.2 with Sun Microsystems Inc. Java HotSpot(TM)
Client VM (mixed mode)

I'm not sure why you wouldn't have this function. MATLAB
is expecting this file to exist in:

<MATLABROOT>\toolbox\matlab\datatypes\@opaque\toChar.m

It appears you are missing some files and/or directories.
All I can suggest is to reinstall MATLAB. Also, you might
want to update your version of Java.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
code us 15 Feb, 2008 03:04:57
java us 15 Feb, 2008 03:04:57
import us 15 Feb, 2008 03:04:57
file us 15 Feb, 2008 03:04:57
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics