MATLAB Answers

Why can't I use a format statement that has alphanumeric, numeric and integer variables?

1 view (last 30 days)
Kenneth Lamury
Kenneth Lamury on 27 Jul 2016
Commented: dpb on 27 Jul 2016
Here are two formats I want to use. They both come from FORTRAN format statements. The first is 6F7.0,2F3.0,2I3,I2,6A4, while the second is 5A4,A1,7F7.0. Since they are in fixed field lengths and represent a row matrix, why can't I use a format statement that has alphanumeric (char/string), numeric (floating point) and integer (non-floating point) variables?
MATLAB gives me 'concatenated cell mismatch' or 'exceeded dimensions'.

Accepted Answer

Walter Roberson
Walter Roberson on 27 Jul 2016
The lines of code you posted there work fine for me.
The error messages you report are consistent with the possibility that you created a variable named "repmat"
dpb on 27 Jul 2016
"Will go back to fscanf, cell2mat & textscan for my reads."
Just clean up your environment to eliminate any typos and ensure you don't accidentally alias repmat and all should be fine.
As shown in previous postings in the (seemingly interminable) quest, you're barking up the wrong tree in trying to duplicate Fortran in Matlab--use the facilities in Matlab as they're intended OR has often also been suggested, convert the Fortran you have to a mex file or, if you don't have the source but only an executable, use system to dispatch it and return its output or write a wrapper function that does it.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!