0

我正在编写一个程序来决定用户输入在数据文件中的内容。我怎样才能做到这一点?

代码:

close all, clear all, clc;

%asking the user to input data
L=input('\Enter the value of length, L: ');

%load data file
load data.dat;
module=data(:,1);
l=data(:,2);

n=length(l);

for i=1:1:n
   if L==l(i);
       fprintf('\nLength = %.0f is found in the standard specification', l(i));
   else
       fprintf('\nLength = %.0f is NOT found in the standard specification', L);
   end
end

数据文件:

1  300
2  591
3  752
4  801
5  1002
6  1200
7  1678
8  2190
4

0 回答 0