how to call the function from the other file?
Show older comments
Hi,
I have a function file attached, and the file I want to read with that function. The file I am trying to read does not have any extension as it is a binary file but the name of the file is 202209201120
How would I call that function ?
sofar I have tried but I think its wrong
close all; clear all; clc;
filename = '202209201120';
S = fileread(filename);
[int_gen_hd,rl_gen_hd,rl_datsp_hd,char_hd,int_datsp_hd,rr_dat_mat] = rdnim(S)
Error:
Error: File: rdnim.m Line: 3 Column: 79
Local function name must be different from the script name.
Error in raindata (line 4)
[int_gen_hd,rl_gen_hd,rl_datsp_hd,char_hd,int_datsp_hd,rr_dat_mat] = rdnim(S)
Accepted Answer
More Answers (1)
Remove the first line from rdnim.m:
close all; clear all; clc;
so that rdnim.m starts with the function keyword:
function [int_gen_hd,rl_gen_hd,rl_datsp_hd,char_hd,int_datsp_hd,rr_dat_mat] = rdnim(fl_name)
(Modified rdnim.m attached.)
Then call rdnim with a file name as the argument, specifying the full path to the file:
filename = 'C:\some\directory\202209201120';
[int_gen_hd,rl_gen_hd,rl_datsp_hd,char_hd,int_datsp_hd,rr_dat_mat] = rdnim(filename)
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!