f



Question about 'fread' in C-S-Function

I made an xpc target model. There is a data (one demension vector with 500 elements) always need to be 

read and saved(overwritten). I'm using "xpc target scope"(type file) to save the data(test.dat) to 

harddisk of xpc. To read the data I once made an M-file like following:

% Attach to the target PC file system.
f=xpctarget.fs;

% Open the file, read the data, close the file.
h=fopen(f,'test.dat');
data=fread(f,h);
fclose(f,h);

% Unpack the data.
x=readxpcfile(data);

But it can only work on host pc. Now I need to make a C-S-Function to realise it on target pc and have 

2 problems.

1 In C-Program here should be 'fread(buffer,size,count,fp)', can anyone help me how to set here 

'buffer','size' and 'count'?

2 The C-S-Functio doesn't kown 'readxpcfile', then how can I unpack and get the end data x?
0
wq13579 (2)
3/27/2013 7:46:06 PM
comp.soft-sys.matlab 211264 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

0 Replies
618 Views

Similar Articles

[PageSpeed] 7

Reply:

Similar Artilces:

Error while obtaining sizes from MEX S-function 'forward' in block 'dummy/Dynamic_Model/S-Function'. MATLAB error message:.
Hi to everybody, I created the file forward.dll using the command: mex -DWIN32 -output forward model_d.c model_s.c sdlib.c assigns.c contact.c derivs.c gmc.c impact.c inits.c invert.c lcp_solver.c lmdif_c.c mathtools.c object.c output.c pipetools.c readmuscles.c readtools.c sdfor.c spring_based.c wrapping.c gcvspl.c user_def.lib forward.lib acpp.lib qhull.lib solid.lib wrap.lib I need to run the command: set_param([subsystemname,'/','S-Function'],'function name','forward','parameters','[0],[0],[0],[0],[0],[0],[1 0 0 0 20],[0]'); ...

MatLab's 'movie' function
Hi! Using MatLab's 'movie' function you can play a movie recorded by the 'getframe' command. It is possible to specify the number of times the movie is played and the frames per second. Unfortunately, I've not found a way to stop the playback of a movie. Is it possible to, let's say I've specified the movie should be played 20 times, to disrupt the playback after an user interrupt?! Thanks a lot, Chris On Sat, 12 Feb 2005 10:40:06 +0100, Christoph ROLZ wrote: >Hi! > >Using MatLab's 'movie' function you can play a movie recorded by...

i wonder result's difference between 'solve function' and 'circcirc function'
i calculate intersection point between two circles. first way, i used solve function. second way, i used circcirc function. By the way two way result is similar. but, The result is the same five-digit decimal. i wonder result's difference between 'solve function' and 'circcirc function' five-digit decimal. >> five decimal places On 7/11/14 7:03 AM, 김영재 wrote: > i wonder result's difference between 'solve function' and 'circcirc function' solve is much more general. Try finding the intersections between y=x^3 and y=9*x us...

s=load('C:\Users\Lubna\matlab\2_1.wav', '-ascii')
when im trying to load a .wav file as ascii, im getting following error , can anybody resolve it??????? s=load('C:\Users\Lubna\matlab\2_1.wav', '-ascii') ??? Error using ==> load Unknown text on line number 1 of ASCII file C:\Users\Lubna\matlab\2_1.wav "RIFFX". "ABC " <looma.amir.ali@gmail.com> wrote in message <jn3vqv$edk$1@newscl01ah.mathworks.com>... > when im trying to load a .wav file as ascii, im getting following error , can anybody resolve it??????? > s=load('C:\Users\Lubna\matlab\2_1.wav', '-ascii') &...

Is there a simple function to generate a list like ['a', 'b', 'c', ... 'z']?
Is there a simple function to generate a list like ['a', 'b', 'c', ... 'z']? The range() just can generate the numeric list. On Apr 9, 2007, at 3:29 AM, =E4=BA=BA=E8=A8=80=E8=90=BD=E6=97=A5=E6=98=AF=E5= =A4=A9=E6=B6=AF=EF=BC=8C=E6=9C=9B=E6=9E=81=E5=A4=A9=E6=B6=AF=E4=B8=8D=20 =E8=A7=81=E5=AE=B6 wrote: > Is there a simple function to generate a list like ['a', 'b', 'c', ... > 'z']? The range() just can generate the numeric list. import string list(string.lowercase) 人言落日是天涯,望极天涯不见家 schrieb: > Is there a simple ...

A function with 'and' , 'not' , 'null' , 'car' and 'cdr'
What's this ? (defun enigma (x) (and (not (null x)) (or (null (car x)) (enigma (cdr x))))) "I suppose I should learn Lisp, but it seems so foreign." - Paul Graham, Nov 1983 On Wed, Oct 07 2015, CAI GENGYANG wrote: > What's this ? > > > (defun enigma (x) > (and (not (null x)) > (or (null (car x)) > (enigma (cdr x))))) Bad taste? It returns T if the list X contains nil as an element. It would be clearer to write (some #'null x). Helmut CAI GENGYANG ...

Trial of Musatov's theory: double spaced 'e x p a n d s' and single spaced 'c o n t r a c t s'. Does the spacing post-processing appear equal? If so, what force was lost and where did it g
Musatov's theory 'The space between spaces expands and contracts.' Would this give time a direction? Musatov ...

Calling 'foo.c' or 'foo2.c' from my 'main_code.c'
Hello. I don't know if following is possible. I've got 'main_code.c': ............................ char * another_code; another_code = "foo.c"; ............................ I've got 'foo.c': ............................ #include <stdio.h> int main() { printf ("Hello world from 'foo.c'!\n"); return 0; } ............................ I would like to call 'foo.c' main function from 'main_code.c'. Is this possible? Thank you very much and best regards. Francesco Moi <francescomoi@europe.com> scribbled the ...

Error? s = assignin('base','s',tf('s'));
Hi, I need a little help here. Could anyone please tell me what is wrong with this command? s = assignin('base','s',tf('s')); The matlab syntax is -- assignin(ws, 'var', val) Basically I just want to add s=tf('s') into the base workspace. Jack "Jack" <Jack@Jill.com> wrote in message news:ef3e449.-1@webcrossing.raydaftYaTP... > Hi, > I need a little help here. Could anyone please tell me what is wrong > with this command? > > s = assignin('base','s',tf('s')); > > The matlab syntax is -- assignin(ws, 'var', val) > Basically I just want to add s=tf('s') into the base workspace. What does the error message say? Something about too many output arguments, right? How many output arguments does the documentation for ASSIGNIN show that it should return? How many are you asking it to return? http://www.mathworks.com/access/helpdesk/help/techdoc/ref/assignin.html -- Steve Lord slord@mathworks.com ...

A question about 'class' and 'set' at MATLAB
In my project,an error stop my step.Need help!......About class and set value. For example: %Create a class D: D.value = 1; D = class(D,'model'); %Create a class C: C.value = 2; C.submodel = D; C = class(C,'model'); %Create a class B: B.value = 3; B.submodel = C; B = class(B,'model'); %Create a class A: A.value = 4; A.submodel = B; A = class(A,'model'); Now I wanna set D.value = 0, what can I do for that ? A.B.C.D.value ? no,maybe MATLAB is not power enough for this ? t.Michael Chan wrote: &...

Output returned by S-function 'xxxxxxx' in 'xxxxx/S-Function' during flag=3 call must be a real vector of length 1
Hi there, I've found several posts where people are experiencing this error "Output returned by S-function 'xxxxxxx' in 'xxxxxxx/S-Function' during flag=3 call must be a real vector of length 1" but I haven't been able to access a definitive solution. My m-files ran successfully with my previously installed version of Matlab/Simulink (i think V12 from 2000) but I've just upgraded to 2011a and now see this error. in InitializeSizes(u): sizes.NumOutputs = 1; sizes.NumInputs = 2; in Output(t,u): if u(2) == 0 u(2) = 1; end sys = u(1)/u(2); Does anyone have any hints? Is there a new syntax? cheers, Mel "Mel Cutler" <melcinasia@yahoo.co.nz> wrote in message news:iq7t6t$2ld$1@newscl01ah.mathworks.com... > Hi there, > > I've found several posts where people are experiencing this error > "Output returned by S-function 'xxxxxxx' in 'xxxxxxx/S-Function' during > flag=3 call must be a real vector of length 1" but I haven't been able to > access a definitive solution. > > My m-files ran successfully with my previously installed version of > Matlab/Simulink (i think V12 from 2000) but I've just upgraded to 2011a > and now see this error. > > in InitializeSizes(u): > sizes.NumOutputs = 1; > sizes.NumInputs = 2; > > in Output(t,u): > if u(2) == 0 > u(2) = 1; > end > sys = u(1)/u(2); > > Does anyone...

if ('A:B:C' =~ /:(.*?)$/) then why the heck is $1 'B:C' and not just 'C'
To repeat the title, in case it is munged by Google Groups: if ('A:B:C' =~ /:(.*?)$/) then why the heck is $1 'B:C' and not just 'C' I've been developing with perl for years; but even simple things in it still sometimes throw up surprises. The regexp /:(.*?)$/ is anchored on the right by $, then comes a non- greedy match which, AIUI, is the "shortest string it can get away with", preceded by a colon. So I would expect this to pick up just the "C", as it does with /([^:]*)$/. Am I assuming/doing something silly? It is frid...

A beginner's question about C++'s & operator
I was trying to figure out how & work, so I wrote the following code #include <iostream> using namespace std; void print(int &); int main() { int i = 10; int &t = i; cout<<"t = "<<t<<endl; cout<<"&t = "<<&t<<endl; cout<<"&i = "<<&i<<endl; print(t); cout<<"t = "<<t<<endl; return 0; } void print(int &x) { x = 6; cout<<"x = "<<x<<endl; } The output is: x = 10 &x = 0012FF7C &i = 0012FF7C x = 6 i = 6 My que...

Matlab 'mfilt.cicdecim' and 'filter' functions
I am trying to see the response of a CIC filter for a set of input data. I created the filter using the function Hd = mfilt.cicdecim(100, 1, 3) set(Hd, ... 'InputWordLength', 3, ... 'InputFracLength', 0, ... 'FilterInternals', 'FullPrecision'); I have some signed data in decimal in an input array 'x'. If I do, y = filter(Hd, x) 1. I am getting all zeros in y 2. y is not the form of a vector, but has other data in it. I am puzzled on why y has all zeros? Can somebody help? ...

Problem with 'sys' & 'frd' function
Hi, Im trying to get the Time-Domain Impulse Response from Freq Domain. For the same am using the frd & sys functions. Problems while using the same: 1) >> sys = frd(resp,freq,'Hz'); ??? Error using ==> lti.set Property/value pairs must come in even number. Am using the format given in Help,whats the problem? 2) > impulse(sys) ??? Error using ==> rfinputs Not supported for Frequency Response Data models. Says no support. Can someone clarify more on this? Hope will get some inputs. Thanks. Hi Mehul, Regarding 1) The syntax should be >> sys = frd(resp,...

Performance of Matlab 'zip' and 'unzip' functions
I'm using matlab 6.5 and I just realized that it comes with zip and unzip functions. On the first try it seems that the matlab zip functions are slower than other commonly available programs e.g. winzip, winrar. Anyone has any reliable data about the performance of Matlab zip and unzip functions? Failing that, personal experience is good too. Thanks! Terence Leong wrote: > > > I'm using matlab 6.5 and I just realized that it comes with zip and > unzip functions. On the first try it seems that the matlab zip > functions are slower than other commonly available programs ...

Basic question?What 's the key if there 's no FD(Functional Dependencies)?
I have a basic question. Suppose there are 3 attributes: A,B and C. And there are no FD(trivial and non trivial ) What 's the key for it? ABC or nothing??? saturnlee@yahoo.com wrote: > I have a basic question. > Suppose there are 3 attributes: A,B and C. > And there are no FD(trivial and non trivial ) > > What 's the key for it? ABC or nothing??? > [I recently learned about part of this on this news group.] You've got two of the possibilities covered. It's axiomatic, but the set of all attributes -- {A, B, C}, in this case -- form...

{ '0':'c->c->a' ,'1':'a->b->a' .........}
Hi, have anybody a hint , how i get a dict from non unique id's and their different related values. Thanks for advance Chris ###random data # a=range(10)*3 def seqelem(): i=random.randint(0,2) elem=['a','b','c'][i] return elem s=[seqelem() for t in range(30)] print zip(a,s) ## favored result: { '0':'c->c->a' ,'1':'a->b->a' .........} Hi Chris, I may have time to look at the rest of your code later. For now I just want to comment on one line: On Nov 7, 12:24=A0pm, chris <o...

question about a command like 'goto ' in Python's bytecode or it's just a compiler optimization?
My Python version is 2.5.2; When I reading the bytecode of some pyc file, I always found that there are many jump command from different position,but to the same position. You can see this situation in following code(this bytecode is just from one .pyc file and I don't have its source .py file): ...... 526 POP_TOP '' 527 LOAD_FAST 'imeHandle' 530 LOAD_ATTR 'isCnInput' 533 CALL_FUNCTION_0 '' 536 JUMP_IF_FALSE '574' 539 POP_TOP '' 540 LOAD_FAST 'GUIDefine' 543 LOAD_ATTR 'Can...

use of Matlab functions for 'c++'
Hi!!! I'm working with SystemC that is something like a c++ library, and I wanna know how can I use the Matlab functions for 'c++'. I think there is a principal function called 'mexFunction' which is the gateway routine to call all that functions but I've already a 'main' function so I don't know if I can use both or how can I use it without the main, because I need the main function. Thanks. Laura wrote: > Hi!!! I'm working with SystemC that is something like a c++ library, > and I wanna know how can I use the Matlab functions for 'c++'. ...

'ab\c' and 'ab\\c'
I encountered a rather peculiar behavior of strings today. Here is my irb session: ------------------------------------------------------------------- irb(main):001:0> 'ab\c' irb(main):002:0' ' SyntaxError: compile error (irb):2: unterminated string meets end of file from (irb):2 irb(main):003:0> 'ab\\c' => "ab\\c" irb(main):004:0> 'a\b' => "a\\b" irb(main):005:0> ------------------------------------------------------------------- As you can see when I typed 'ab\c' my irb didn't return. It was expecting...

'^=' and '~='?
Hello, What is the difference between '^=' and '~='? Thanks, Duckhye ...

To 'C' or not to 'C' ... now what the hell to I do?
From the WTF department! (WTF: What the fuck!) I have an application that is written in 'C'. It works flawlessly under OpenVMS Alpha V7.3-2 and V8.2. However, I just ran this same executable on V8.3. It's a mess. Because it is the same executable as run on the other VMS versions, I'd conclude that there's something SERIOUSLY horked in the C RTL on V8.3. -- VAXman- A Bored Certified VMS Kernel Mode Hacker VAXman(at)TMESIS(dot)COM "Well my son, life is like a beanstalk, isn't it?" http://tmesis.com/drat.html In article <gIQjj.1370$eT.982@newsfe12.lga>, VAXman- @SendSpamHere.ORG wrote: > From the WTF department! (WTF: What the fuck!) > > I have an application that is written in 'C'. It works flawlessly under > OpenVMS Alpha V7.3-2 and V8.2. However, I just ran this same executable > on V8.3. It's a mess. Because it is the same executable as run on the > other VMS versions, I'd conclude that there's something SERIOUSLY horked > in the C RTL on V8.3. For either of your two questions (WTF? and "now what?") some description of the mess might increase the accuracy of guesses for people attempting to answer. If the CRTL is involved in your problems (and there's no evidence of that here as yet), the first thing I'd do is check and compare feature settings between the two systems: $ show logical DECC$* Other system differences only tangentiall...

calling '!' or 'system' in matlab different than same functions from shell
Hi everyone, When I am in the shell (tcsh) on my Mac (outside Matlab), I am able to use the command line utility ncdump to read netcdf format files (http://www.unidata.ucar.edu/software/netcdf/): ncdump -h testfile.nc However, in Matlab, the same command preceded by the '!' (or using 'system') generates an error: >> !ncdump -h test.nc dyld: Library not loaded: /opt/local/lib/libnetcdf.7.dylib Referenced from: /opt/local/bin/ncdump Reason: Incompatible library version: ncdump requires version 10.0.0 or later, but libnetcdf.7.dylib provides version ...

Web resources about - Question about 'fread' in C-S-Function - comp.soft-sys.matlab

Resources last updated: 3/10/2016 7:13:06 AM