How do we declare multiple variables at once using letters and values of two columns of a table?
1 回表示 (過去 30 日間)
古いコメントを表示
INTRODUCTION: Hi, I have an alpha-numeric text file. The first column contains the alpha and the second column the numeric content. An example is given below:
% test=
% a 2
% b 30
% c 45
% d 13
% e 50
I import the file as follow
fid =fopen('C:\Users\EMERSON\Desktop\test.txt');
A=textscan(fid,'%s %f');
fclose(fid);
A1=A{1,1};
A2=A{1,2};
GOAL:
i) I want to write a command that create variables using the alpha characters of the first column and the corresponding value of the second column. In this way, I would type a and enter and would obtain the result 2, or type d to obtain the result 13, and so on.
ii) Conversely, later I import an array only with numeric values I would like to substitute the values by the letters assigned above.
I wounder if someone could suggest me a command to do these things
Thanks in advance for you help
Emerson
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Whos についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!