how do I transfer .dat test file into matlab?

조회 수: 3 (최근 30일)
Kendell
Kendell 2023년 2월 15일
댓글: Steven Lord 2023년 2월 15일
I am trying to sample from a script written by someone in 2015. Everything else in my code should function correctly if I can get this file to be mined. I need to get it into [channels,data] in order for my code to function properly. Being from such an old version of matlab, I'm sure there's an different way to do this now. Any help would be greatly appreciated.
%Directory of test file
filename='Test_1';
filedir='C:\Users\admin\Documents\Testing\Test_1\';
%Calls sub function to mine data from .dat test file
[channels,data]=getfile(filedir,strcat(filename,'.csv'));
This is the error message that I get:
Undefined function 'getfile' for input arguments of type 'char'.
Error in OBS_ONE_Reduction (line 10)
[channels,data]=getfile(filedir,strcat(filename,'.csv'));
  댓글 수: 3
Les Beckham
Les Beckham 2023년 2월 15일
If you attach your file, I'm sure someone can help with how to read it.
dpb
dpb 2023년 2월 15일
That's second recourse if first doesn't work,@Les Beckham... :)

댓글을 달려면 로그인하십시오.

답변 (1개)

Oguz Kaan Hancioglu
Oguz Kaan Hancioglu 2023년 2월 15일
I understand that getfile is a function that was already developed in your application in 2015. Now, Matlab has a getfile function and needs some hardware object as a first argument. Maybe changing "getfile" function name solves this problem.
  댓글 수: 4
dpb
dpb 2023년 2월 15일
Easy enough to miss...but as a side note to TMW, that's a TERRIBLE function name to introduce into base or toolbox product -- that one's bound to clash with thousands of user-written functions of the same name (including the camelCase spelling).
Steven Lord
Steven Lord 2023년 2월 15일
There's no clash unless you try to call a user-defined getFile function with an rosdevice or ros2device object as input. The getFile method of rosdevice or ros2device objects is at level 7 of the function precedence order.
You could override that by writing a nested or local function named getFile (levels 3 or 4) or a private function by that name (level 6) and calling those with the ros*device object input. Or you call your getFile without specifying an object whose class has that method defined, that can call functions in the current folder or on the path (levels 10 or 11.)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Report Generator Creation에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by