在MATLAB中的函数中使用eval导致错误

时间:2018-09-17 09:53:34

标签: matlab eval

我具有以下MATLAB函数:

@ControllerAdvice
public class ExceptionHandlingController {


    @ExceptionHandler(MethodArgumentNotValidException.class)
    public ResponseEntity<ErrorMessage> handleException(MethodArgumentNotValidExceptione e){

     //e.getBindingResult().getAllErrors()

     }

     @ExceptionHandler(JsonMappingException.class)
     public  
     ResponseEntity<ErrorMessage>handleJsonMappingException(JsonMappingException e){
     }

}

它在下面被调用:

function getDBLfileL1(pathInput,Name_file,folderName)
   DBL_files=dir([pathInput,'/*.DBL']); %get DBL files 
   fprintf('Reading DBL files ... ')
   for i = 1:length(DBL_files) %loop through all DBL files
       [HDR, CS]=Cryo_L1b_read([pathInput,'/',DBL_files(i).name]); %read data with ESA's Cryo_L1_read function
       Coord{i}.LAT_20Hz=CS.GEO.LAT; %store values to struct
       Coord{i}.LON_20Hz=CS.GEO.LON; 
       Coord{i}.BoundingBox_StartLATLON_StopLATLON=[HDR.START_LAT*10^-6,HDR.START_LONG*10^-6,HDR.STOP_LAT*10^-6,HDR.STOP_LONG*10^-6];
       Coord{i}.FileName=[pathInput,'/',DBL_files(i).name];
   end
   eval([Name_file '= Coord;']);
   save(['output/',folderName,'/',Name_file,'.mat'],Name_file,'-v7.3')
   fprintf('done\n')
end

getDBLfileL1(pathInput,[folderNames{i},'_',folderNames1{j}],folderNames{i}); %read Data from DBL file 的值为Name_file,出现以下错误:

'2011_01'

有人知道为什么会发生此错误或如何更改文件以替换eval([Name_file]) Error: Invalid text character. Check for unsupported symbol, invisible character, or pasting of non-ASCII characters. 函数吗?

非常感谢!

1 个答案:

答案 0 :(得分:1)

如果我做对了,您正在尝试评估'2011_01 = Coord;' ,这意味着您正在将Coord分配给名为2011_01的变量,并且变量名称不能以数字开头