필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to rename S outup of the funtion load ?

조회 수: 1 (최근 30일)
Adrien Luthi
Adrien Luthi 2020년 5월 20일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello everyone,
My problem is the following:
I have stored in a variable struct_name the string "folder_nbr1".
When I load a .mat I want that the name of the output structure is the string stored in struct_name, how can I do this ?
There is my code below but it does not work:
clc;clear ;close all;
folder = 'Trained_Chronic_Combo';
filename = '207_20130424_P62_RW_COMBO_30_17';
nbrMouse = filename(1:3);
if strcmp(folder, 'Trained_Chronic_Combo') == 1
gait = '_T_C_';
elseif strcmp(folder, 'Trained_Acute_Combo') == 1
gait = '_T_A_';
elseif strcmp(folder, 'NonTrained_Chronic_Combo') == 1
gait = '_NT_C_';
elseif strcmp(folder, 'NonTrained_Acute_Combo') == 1
gait = '_NT_A_';
end
data_name_suff = filename(length(filename)-4:end);
data_name{1} = strcat('M',nbrMouse, gait, data_name_suff);
data_name{1} = load([folder '/' nbrMouse '/' filename '.mat']);
%M#_T/NT_A/C_#dataset
I have looked everywhere but do not find any solution...
Thank you !

답변 (1개)

Anmol Dhiman
Anmol Dhiman 2020년 7월 3일
Hi Adrein,
Please folow the link.
Regards,
Anmol Dhiman

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by