why does my script not open the input file provided?

22 ビュー (過去 30 日間)
Miguel Cano
Miguel Cano 2018 年 11 月 16 日
コメント済み: madhan ravi 2018 年 11 月 16 日
I want to write a script that asks the user to inpt the name of the file the user wishes to open. The program will then read the file and select certain elements from the txt file. When i run the program it asks for the file name however, when i provide the filename the program wont do anything and it'll continue to ask me for the file name.
clear;
clc;
close all;
filename = input('Please provide the name of the input file:');
fid = fopen(filename,'r');
temp = fscanf(fid,'%f',4);
j = tmep(1);
m = temp(2);
r = temp(3);
nload = temp(4);
%sanity check
if 2*j ~= (m+r)
fclose(fid);
error('This program can only solve determinate truss ');
end
temp = fscanf(fid,'%f %f',[j 2]);
XY = temp';
fclosef(fid);

採用された回答

madhan ravi
madhan ravi 2018 年 11 月 16 日
編集済み: madhan ravi 2018 年 11 月 16 日
filename = input('Please provide the name of the input file:','s'); % will work
  2 件のコメント
Miguel Cano
Miguel Cano 2018 年 11 月 16 日
thank you
madhan ravi
madhan ravi 2018 年 11 月 16 日
Anytime :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLaTeX についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by