Problem with my code?

조회 수: 17 (최근 30일)
GEORGIOS BEKAS
GEORGIOS BEKAS 2019년 10월 18일
댓글: madhan ravi 2019년 10월 18일
I wrote the following code that is based on reading two csv files that I include.
clc
clear
a = dlmread ('gb.csv')
b = dlmread ('gb2.csv')
function [Qfresh,Qsea] = concentration(CCLspring,Qspring)
CCLsea=19000;
CCLfresh=10;
%Qfresh = Qspring*(CCLsea-CCLspring)/(CCLsea-CCLfresh)
Qsea = Qspring*(CCLspring-CCLfresh)/(CCLsea-CCLfresh)
end
size(a)
size(b)
M=zeros(size(a,1),size(a,2));
for i = 1:size(a,1)
for j = 1:size(a,2)
M(i,j) =concentration(a(i,j),b(i,j))
end
end
I get the following message that I don't understand: 'error: value on right hand side of assignment is undefined'.

답변 (2개)

Star Strider
Star Strider 2019년 10월 18일
I do not see that you defined ‘Qfresh’ anywhere in your function.

Kevin Phung
Kevin Phung 2019년 10월 18일
looks like you included a space:
%a = dlmread ('gb.csv')
%b = dlmread ('gb2.csv')
a = dlmread('gb.csv')
b = dlmread('gb2.csv')
also it seems like dlmread is not recommended: https://www.mathworks.com/help/matlab/ref/dlmread.html
  댓글 수: 1
madhan ravi
madhan ravi 2019년 10월 18일
The space doesn’t cause the error as the OP describes.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by