필터 지우기
필터 지우기

Create variable with names of cell array

조회 수: 20 (최근 30일)
Nidhal Bouzouita
Nidhal Bouzouita 2021년 11월 25일
댓글: Stephen23 2021년 11월 25일
Hello Dear readers,
I need to create new variable (in the workspace) with the name of the variables in a array of cell .
exemple the following array of cell signal = [{'time'},{'voltage'}....]
i need to create a 2 variables . first variable has the name of the first element ( time) and the second with the name voltage.so i can see in the workspace time and voltage . Any help or information please ?
Thanks in advance
  댓글 수: 1
Stephen23
Stephen23 2021년 11월 25일
" Any help or information please ?"
That is a really bad way to write code.
Consider if your cell contained names like these, what would happen:
{'delete','quit','1234','hello world','speed (ms)','if','N/A'}
Robust code does not force meta-data into variable names, but simply stores it in variables, just like you already have.
When you understand that meta-data is data, then you can start to write much better code.

댓글을 달려면 로그인하십시오.

답변 (1개)

James Tursa
James Tursa 2021년 11월 25일

카테고리

Help CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by