Unexpected MATLAB expression when trying to load file

I am trying to load a file into Matlab and I am getting an unexpected MATLAB expression in the first line of code below:
function [data,loginfo]=LoadZmachineData('C:\ProgramData\ZmachineDataViewer\name\Import0\data200\00000.bin')
loginfo = parse_wbpp_log_public(strrep(file_name,'bin','LOG'));
The warning from MATLAB when hovering over this code reads:
"Invalid syntax, possibly missing a ')'" "Use a newline, semnicolon or comma before this statement" "Parse error at ')' might be invalid MATLAB syntax)"
I have tripled checked that the path is correct.
Thank you for your time.

2 个评论

Edward - can you post the code instead? i.e. please attach the m-file with just those lines of code that are showing the error.
Apologies, I have attached the m-file to this comment.

请先登录,再进行评论。

 采纳的回答

Edward - please look at your function signature
function [data,loginfo]=LoadZmachineData('C:\ProgramData\ZmachineDataViewer\Ed\Import0\data200\00000.bin')
loginfo = parse_wbpp_log_public(strrep(file_name,'bin','LOG'));
Note how you are passing in a string literal as opposed to a variable representation of that that string. Your signature should be
function [data,loginfo]=LoadZmachineData(file_name)
loginfo = parse_wbpp_log_public(strrep(file_name,'bin','LOG'));
and then you call this function from the command line as
>> [data,loginfo]=LoadZmachineData('C:\ProgramData\ZmachineDataViewer\Ed\Import0\data200\00000.bin')
Note how when we call this function, we pass the string (path to your file) in.

更多回答(0 个)

类别

Community Treasure Hunt

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

Start Hunting!

Translated by