From: Ryan on
Hi, I'm fairly new to the xPC toolbox so I'm trying to start slow... real slow. All I want to do is use simulink blocks to have the xPC target read a file consisting of doubles and ouput the values to a scope. Nothing fancy since I'm just starting out.

I created an xpc configured file using the xpcbytes2file command. (xpcbytes2file('myfile', x)); Where x was a 1x7 matrix of doubles. This created an extensionless file called 'myfile'. Then my simulink model consisted of only 2 blocks (the xpc target "from file" block and an xpc target scope). I configured the "from file" block to read 'myfile' and set the output size to 8 bytes. When I build the model, the xpc screen gives me an error saying "Error: could not open file myfile".

What am I doing wrong? This seems very simple. A similar program using the regular "from file" block worked fine on the host computer. I tried adding a .mat extension to myfile, but that didn't work. I tried increasing the output size of the "from file" block, but that didn't work. I assume I'm missing something trivial. Any help would be appreciated. Thanks.
From: Gordon Weast on
Ryan,

You didn't say you copied your data file to the target file system.
Use either a file system object or an ftp object.

The target can't read from a file system on the host, only from
the disk in the target. This is designed to allow you to move to
the embedded model, where a host isn't connected.

The file name will need the disk qualifier as well on the target.

'c:myfile' or 'c:\mysubdir\myfile'

Gordon Weast
xPC Target Development
The MathWorks

Ryan wrote:
> Hi, I'm fairly new to the xPC toolbox so I'm trying to start slow... real
> slow. All I want to do is use simulink blocks to have the xPC target read a
> file consisting of doubles and ouput the values to a scope. Nothing fancy
> since I'm just starting out.
>
> I created an xpc configured file using the xpcbytes2file command.
> (xpcbytes2file('myfile', x)); Where x was a 1x7 matrix of doubles. This
> created an extensionless file called 'myfile'. Then my simulink model
> consisted of only 2 blocks (the xpc target "from file" block and an xpc
> target scope). I configured the "from file" block to read 'myfile' and set
> the output size to 8 bytes. When I build the model, the xpc screen gives me
> an error saying "Error: could not open file myfile".
>
> What am I doing wrong? This seems very simple. A similar program using the
> regular "from file" block worked fine on the host computer. I tried adding a
> .mat extension to myfile, but that didn't work. I tried increasing the
> output size of the "from file" block, but that didn't work. I assume I'm
> missing something trivial. Any help would be appreciated. Thanks.