MATLAB Answers

0

¿how can I show a matrix of type -cell- in a msgbox?

Pedro Guevara さんによって質問されました 2019 年 6 月 25 日
最新アクティビティ Pedro Guevara さんによって コメントされました 2019 年 6 月 28 日
I annoy them with another great concern that I have. I'm doing a program in which we must show matrices with numeric and non-numeric characters (letters); I am putting these matrices in matrixes of the cell type. What I want is to show these matrices in messages - msgbox -, and try to put them directly (as would be done with a numeric matrix type double) but I get errors, and try making use of several commands like -str2double- and several more, but not I get the matrix to appear in an organized and neat way. Could someone help me with this matter?
I leave a piece of the code, this piece contains one of my matrices that I want to show in -msgbox -
Note: My arrays are not of constant dimensions.
for f=1:NP
[Pos_GL_Y1] = find( NodosT (:,2) == NodosT1(f,1) );
[Minx_piso,Pminx]= min( NodosT( Pos_GL_Y1,1 ) );
Zi (:,f) = abs( Coe_par(f,1) )* M_Sd(f,1); % desplazamientos
Zi_c (:, f) = [ num2cell( Zi (:,f) ) ; ['Mod',num2str(f)] ] ;
Yp(1:NP, f)= Modos (:,f)*Zi(1,f);
Yp(f, 4)= NodosT ( Pos_GL_Y1 (Pminx,1) , 3 );
Yp_c (:, f) = [ num2cell(Yp(1:NP, f)) ; ['Mod',num2str(f)] ] ;
Yp_c {f, NP+1} = ['U ',num2str( NodosT ( Pos_GL_Y1 (Pminx,1) , 3 ) )] ;
menospiso=menospiso+1; % BORRAR
end
cell.png
As shown in the image, I want my matrix "Yp_c" to be seen in a msgboxmsgbox.
Thank you very much for your help.

  1 件のコメント

Jan
2019 年 6 月 26 日
"put them directly (as would be done with a numeric matrix type double)" - What does this mean?
"I get errors" - Then please post the code with some inputs and y copy of the complete error message.
"not I get the matrix to appear in an organized and neat way" - The readers cannot guess, what you call "neat and organized". The screen shot is a hint, at least.
"this piece contains one of my matrices that I want to show in -msgbox -" - We cannot run the code due to missing inputs. It is not clear, which array you mean.

サインイン to comment.

2 件の回答

回答者: Shameer Parmar 2019 年 6 月 26 日
 採用された回答

I understood your problem, but I dont know the axact value of matrix 'Yp_c' because it is not properly visible in your questions.
So I took reference of another matrix 'Ys_c' (7 by 4) and creaetd logic here for you.
So you can apply this logic to your matrix by replacing it with actual values.
See attached code... You can modify it as per your requirement.. Thanksss..

  3 件のコメント

Pedro Guevara 2019 年 6 月 26 日
Thank you very much for everyone for your prompt responses.I apologize for the error I had, effective the matrix to which reference was the matrix "Ys_p". I only have one question, my matrix does not necessarily have to have the values ​​or the size that I showed in the image. ¿ Your code could be adjusted by using some cycle to be used for cases in which the matrix is ​​of different size and the elements are not the same ? Thank you.
Shameer Parmar 2019 年 6 月 27 日
NO matter of any matrix.. here you can copy my code from line #18 to the end and replace the matrix 'Yp_c' with your matrix name and see the results... You can adjust the code is the output message is not displaying properly..
Please try for this..
If you are still facing issue, then provide me your input files and tell me the expected results.. I can ready to help you.. Good Luck..
Pedro Guevara 2019 年 6 月 28 日
It works perfect. many thanks.

サインイン to comment.


Jan
回答者: Jan
2019 年 6 月 26 日

  0 件のコメント

サインイン to comment.



Translated by