form in separate table from text file

a= 5 0 0.0123 0.232 0.252
5 2 0.326 0.325 0.325
5 4 0.256 0.145 0.369
6 0 0.321 0.362 0.325
6 2 0.365 0.231 0.213
6 4 0.321 0.325 0.365
7 0 0.325 0.3565 0.145
7 2 0.545 0.656 0.545
7 4 0.365 0.898 0.787
This is my input file. where if select No.5 the values with that particular Num should display
like Enter the num=5
5 0 0.0123 0.232 0.252
5 2 0.326 0.325 0.325
5 4 0.256 0.145 0.369
Enter the num=7
7 0 0.325 0.3565 0.145
7 2 0.545 0.656 0.545
7 4 0.365 0.898 0.787
enter the num=6.5
those should be displayed an interpolation
Please help me in this code . Thank you!

Respuestas (1)

KSSV
KSSV el 18 de Oct. de 2022
Editada: KSSV el 18 de Oct. de 2022
a = [5 0 0.0123 0.232 0.252
5 2 0.326 0.325 0.325
5 4 0.256 0.145 0.369
6 0 0.321 0.362 0.325
6 2 0.365 0.231 0.213
6 4 0.321 0.325 0.365
7 0 0.325 0.3565 0.145
7 2 0.545 0.656 0.545
7 4 0.365 0.898 0.787] ;
num1 = 5 ;
idx1 = ismember(a(:,1),num1) ;
a(idx1,:)
num2 = 7 ;
idx2 = ismember(a(:,1),num2) ;
a(idx2,:)

3 comentarios

solleti prabhakarchary
solleti prabhakarchary el 18 de Oct. de 2022
its showing all the values
KSSV
KSSV el 18 de Oct. de 2022
Thats what you wanted to.
solleti prabhakarchary
solleti prabhakarchary el 18 de Oct. de 2022
if i enter 6 those values need to be stored in a variable
but it was displaying for 5 &7 also with out command

Iniciar sesión para comentar.

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 18 de Oct. de 2022

Comentada:

el 18 de Oct. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by