The enviinfo function was used incorrectly, I don't know what went wrong.

3 Ansichten (letzte 30 Tage)
宁 甘
宁 甘 am 22 Sep. 2021
Kommentiert: 宁 甘 am 22 Sep. 2021
Wrong use of cell2struct, field name "Exposure(Ms)" is invalid.
I don't know what he means.

Antworten (1)

Walter Roberson
Walter Roberson am 22 Sep. 2021
It appears that the data file has a header that is Exposure (Ms) .
This is not a standard ENVI header, but MATLAB tries to put all of the headers from the file into the information structure.
In the current implementation, MATLAB tries to do that by using the names in the header as field names in a struct. However, Exposure (Ms) is not a valid MATLAB field name, and the process fails.
There is no option you can use to fix the problem; there is a mismatch between the expectation of the code (that all field names in the file with be valid MATLAB identifiers) and what you have in the file.
If you are willing to edit the Mathworks enviinfo code, you should be able to work around the problem.
In your version (R2021a) line 256 of the enviinfo.m file currently reads
otherwise
Immediately above that, insert these lines
case 'Exposure (Ms)'
key = 'Exposure_ms'; % Scalar numeric value
value = str2double(strtrim(split(value,',')));
... I am guessing here that the current field is not giving the exposure time in mega-seconds and that it is badly named ms (milli-seconds)
  4 Kommentare
宁 甘
宁 甘 am 22 Sep. 2021
I removed the ms unit brackets based on the code you provided and it works, could it be that the bracket symbol is affecting the program.

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by