Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9265229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:01:05+00:00 2026-06-18T14:01:05+00:00

I have a multispectral image and I’ve a question. I’ve found a function code

  • 0

I have a multispectral image and I’ve a question. I’ve found a function code on the internet which allows to read this kind of images. The problem is I received the following error:

??? function [lan_data] = lanread('montana.lan')
    |
Error: Function definitions are not
permitted in this context.

Also, when I checked the help of the ‘lanread’ command I received the following information: “>> help landread

landread not found.”

Is possible that this command doesn’t exist? I haven’t found so much information about it.

Thanks in advance,

PD) This is the function code.

function [lan_data] = lanread('montana.lan','C:\formato_lan')
% LANREAD Read Landsat data file type .lan
% Ex: im = lanread('montana.lan')
% size(im) = [m,n,d];
    % (From landsatdemo in the image analysis toolbox.)

% $Id: lanread.m 3325 2007-04-06 15:52:34Z finn $

if (nargin<2), thepath = []; end
if isempty(thepath)
  [p,n,e]=fileparts(which('fms150path'));
  thepath= {fullfile('.',filesep),...
            fullfile(p,filesep,'data',filesep),...
            fullfile(p,filesep,'data',filesep,'protected',filesep),...
            fullfile(p,filesep,'data',filesep,'protected',filesep, ...
                     'lan',filesep),...
            ''};
elseif ischar(thepath)
  thepath = {thepath};
end

fid = -1;
if (fid<0)
  for path_idx=1:length(thepath)
    filename = sprintf('%s%s',thepath{path_idx},lan_filename);
    fid = fopen(filename,'r');
    if (fid>=0), break; end
  end
  if (fid<0) % If not found anywhere
    error(sprintf('Could not open file: %s',filename));
  end
end

% find out how big the image is based on file size,
% assuming square image, 7 bands
nbands = 7;
fseek(fid,0,'eof');
file_bytes = ftell(fid);
nlines = floor(sqrt(file_bytes/nbands));
nsamples = nlines;

% skip header
nbytes_header = 128;
fseek(fid,nbytes_header,'bof');

% prepend * to read data into an array that has the same class as the data
A = fread(fid,[nsamples nlines*nbands],'*uint8'); 

fclose(fid);

% put data into a 3D array
A_3dim = reshape(A,nsamples,nbands,nlines);
lan_data = permute(A_3dim,[3 1 2]);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:01:07+00:00Added an answer on June 18, 2026 at 2:01 pm
    1. When calling a function (as opposed to defining a function) you do not need to use the keyword function. So, in order to use the function you just

      [lan_data] = lanread(‘montana.lan’);

    2. When declaring the function, you must use the keyword function but with argument names. So the first line in file lanread.m should be

      function [lan_data] = lanread(lan_filename, thepath)
      

      and not

      function [lan_data] = lanread('montana.lan','C:\formato_lan')
      

      only when you call the function you use the values 'montana.lan' and 'c:\formato_lan' as arguments.

    3. To get help you need to type exactly the function name

      doc lanread

    and not landread

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have the following code: $(#blogs).mouseover( function () { $(this).addClass(hover); $(#home).removeClass(hover); $(#homepages).removeClass(hover); $(#apps).removeClass(hover); $(#facebook).removeClass(hover); $(#kontakt).removeClass(hover);
have written this little class, which generates a UUID every time an object of
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
have defined a Java Interface with the annotation @WebService Compiled the code which went
Have this block: jQuery(document).ready(function($) { $(img[src$='.jpeg'], img[src$='.jpg'], img[src$='.png'], img[src$='.gif']).wrap('<div class=b-img/>').each(function() { var src =
have a little question concerning image icons in java and how to put a
have code obj.property.style.split( /\s*;\s*/ ).forEach( function(s) {... the problem is that the */ in
Have written all the code in a silverlight class library (dll) and linked this
Have: [DllImport(OpenAL32.dll)] static extern void alcOpenDevice(char*[] devicename); Wanna send the name to this function
Have a look at this code: #include <iostream> using namespace std; int main() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.