addpathができない

Macbookでaddpathをすると、フォルダから、データを読み取らないのですが、どうすればよろしいでしょうか。
addpath csvデータ;
これだと、csvデータフォルダの中にある必要なデータが抽出できないです。
よろしくお願いいたします。

1 Comment

Kojiro Saito
Kojiro Saito on 29 May 2023
ご質問はaddpathでCSVファイルが読み取れないということでしょうか?
apppathは任意の「フォルダー」をMATLABの検索パスに加えるコマンドで、個々のCSVファイルを読み取るのはreadtablereadmatrixなどを使います。

Sign in to comment.

Answers (1)

Hernia Baby
Hernia Baby on 29 May 2023
@Kojiro Saitoさんもおっしゃっていますが、addpathはPathを通す、つまり住所を通すだけです。
データを読むには読み込む関数が必要です。
tmpフォルダを作ります
mkdir('tmp')
ls
tmp
tを作り、tmpフォルダにtest.matという形で書き込みます
t = (1:5)';
save(fullfile(pwd,'tmp','test.mat'),'t')
パスを通します
addpath(fullfile(pwd,'tmp'))
ls
tmp
ワークスペースを空にしてパスを加えたフォルダ内のtest.matを読み込みます
clear
load('test.mat')
t
t = 5×1
1 2 3 4 5

Products

Release

R2022a

Tags

Asked:

on 29 May 2023

Answered:

on 29 May 2023

Community Treasure Hunt

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

Start Hunting!