Unable to perform assignment because the size of the left side is 111-by-1 and the size of the right side is 112-by-1.
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I am unable to figure it out or understand what is happening here. i am trying to do the plotting of certain column from 3 csv files (files are attached) but getting the error below.
Error:
Unable to perform assignment because the size of the left side is 111-by-1 and the size of the right side is 112-by-1.
Error in FlushFlow_DataComparison (line 11)
col_1_distance(:,i) = table2array( data(:,1) ); % get the 13th column of each file
Code:
close all; clear all; clc;
P = 'F:\3-PIV_Experimental_Data\Calculations_TurbulentIntensity\line_Data\LSA_FlushflowMag_Data';
S = dir(fullfile(P,'*.csv'));
N = natsortfiles({S.name});
for i = 1:numel(N);
data = readtable( fullfile(P, N{i}) ); % read the csv files
col_1_distance(:,i) = table2array( data(:,1) ); % get the 13th column of each file
col_7_TurbulentIntensity(:,i) = table2array( data(:,7) );
end
plot (col_1_distance,col_7_TurbulentIntensity,'*-');
0 件のコメント
採用された回答
KSSV
2022 年 6 月 21 日
The error is siimple, you are trying to save more number of elements than the array is initialized for.
A = zeros(2,3) ; % 2x3 matrix is initialized
A(1,:) = rand(1,2) ; % no error, 1 1x2 array is saved
A(2,:) = rand(1,3) ; % error, you cannot save 1x3 array into 1x2
In the same, way check your initialized array dimensions. If you are sure of array size, initiailze it as a matrix. If not initialize it as cell .
B = cell(2,1) ;
B{1} = rand(1,2) ;
B{2} = rand(1,3) ;
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!