MATLAB Answers

Dimensions of arrays being concatenated are not consistent.

10 ビュー (過去 30 日間)
Kaleesh Bala
Kaleesh Bala 2019 年 9 月 19 日
回答済み: Adam 2019 年 9 月 19 日
Here all the variable are of 1X3 except velocity which is 1X2
So,how shall I add even that value in the sheet ? as I get Dimensions of arrays being concatenated are not consistent error
%save as excel
filename = 'Nomexhole2.xls';
Results_Names={'Amp','N','T','velocity'};
Results_Values=[Amp',N',T',velocity.'];
sheet=1;
xlRange='A1';
xlswrite(filename,Results_Names,sheet,xlRange);
sheet=1;
xlRange='A2';
xlswrite(filename,Results_Values,sheet,xlRange);
winopen('Nomexhole2.xls');

  6 件のコメント

表示 3 件の古いコメント
Bob Nbob
Bob Nbob 2019 年 9 月 19 日
If you want to keep all of the data together, using preallocation:
Results_Values = nan(3,4);
Results_Values(1:3,:) = [Amp',N',T'];
Results_Values(4,1:2) = velocity.';
When you tried to print the velocity values to the second sheet, what command did you use? It may not have been the writing command that was actually causing the issue.
Adam
Adam 2019 年 9 月 19 日
Results_Values=[Amp',N',T',[velocity NaN].'];
should also work.
Kaleesh Bala
Kaleesh Bala 2019 年 9 月 19 日
Thank you Bob and Adam
When I used Preallocation it showed Unable to perform assignment because the size of the left side is 3-by-4 and the size of the right side
is 5-by-3
But [velocity NaN] worked well ,also I've used this command also worked
velocity(end+1:numel(T))=0;
Thank you again !
Kindly put this agian in the answer this question section ,so that I can mark it as complete with a vote.

Sign in to comment.

採用された回答

Adam
Adam 2019 年 9 月 19 日
Results_Values=[Amp',N',T',[velocity NaN].'];

  0 件のコメント

Sign in to comment.

その他の回答 (0 件)

タグ

製品


Translated by