How to browse and open txt file with columns separated by comma and then plot specific columns of txt file in app designer?

1 回表示 (過去 30 日間)
Hi there,
I want to make an app in matlab app designer where i can press a button to browse in my pc for a .txt file to be plotted. The .txt files have columns separated by comma. In the first line are the name of every column and in the next lines are the values. Finally i want to plot the first and the 4th column of the .txt file in the app.
Thank you in advance!
An example of a .txt file:
Time,Fx,Fy,Fz,Mx,My,Mz,CoPx,CoPy
0.000000,-0.266824,0.018264,0.014903,-0.138619,-0.055320,-0.010411,0.000000,0.000000
0.001000,0.076356,0.018184,-0.662687,-0.008139,0.060740,0.037519,0.000000,0.000000
0.002000,0.416136,-0.159016,0.027313,0.007711,-0.011980,-0.033421,0.000000,0.000000
0.003000,0.077866,0.015974,0.008063,-0.267419,0.057910,-0.009851,0.000000,0.000000
0.004000,0.244836,-0.156286,0.716503,0.004721,0.070190,-0.018391,0.000000,0.000000
0.005000,-0.099364,-0.156026,0.358683,-0.061559,0.094040,0.045719,0.000000,0.000000
0.006000,-0.094664,0.192574,-0.314487,0.046081,0.003040,-0.018451,0.000000,0.000000
0.007000,-0.268604,0.018314,0.360893,-0.072979,-0.009490,-0.010331,0.000000,0.000000
  1 件のコメント
Rik
Rik 2019 年 5 月 15 日
These are two separate tasks: making the function that does the work, and making the GUI with a single button. For both you should be able to find a lot of examples. What have you tried so far?

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

回答 (1 件)

Jan
Jan 2019 年 5 月 15 日
  • "I want to make an app in matlab app designer"
appdesigner
(By the way: It was extremely hard to find this command. I've searched in the online documentation for 20 minutes without success. But this linke revealed, how to start the AppDesigner: https://lifeinplaintextblog.wordpress.com/matlab-app-designer-tutorial-1-english/ )
  • "browse in my pc for a .txt file"#
Insert uigetfile('*.txt') in the callback.
  • "The .txt files have columns separated by comma."
Use readmatrix.
  • "plot the first and the 4th column of the .txt"
plot(Data(:, 1), Data(:, 2));

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by