error in matlab function block
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
- Item one
- Item twoi am using a 'matlab function' block i write the code to map a file to memory using this instructions
filename = fullfile(tempdir, 'talk_answer.dat');
m = memmapfile(filename, 'Writable', true, 'Format', 'double');
j=m.data(1:5);
i have an error in "j=m.data(1:5);" this error appears " Attempt to extract field 'data' from 'mxArray'. Function 'MATLAB Function' (#23.1222.1223), line 43, column 4: "m" Launch diagnostic report."
what can i do to avoid this error
댓글 수: 3
Geoff Hayes
2014년 8월 20일
Prior to executing the line j=m.data(1:5), type the following in the Command Window
disp(m)
What is written to the console? Please paste the results to a comment. As well, please include your version of MATLAB.
Geoff Hayes
2014년 8월 21일
편집: Geoff Hayes
2014년 8월 21일
What happens if you just run the following test code
myData = double(1:10)';
filename = fullfile(pwd, 'records.dat');
fileID = fopen(filename,'w');
fwrite(fileID, myData,'double');
fclose(fileID);
testVar = memmapfile(filename, 'Writable', true, 'Format', 'double');
k=testVar.data(1:5);
It will create a small file and then execute the same commands as before.
Also, type
which m -all
I am just curious if your choice of variable name m is conflicting with something else.
답변 (0개)
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!