Get "The expression to the left of the equals sign is not a valid target for an assignment" Error Message for Every Single Assignment

1 vue (au cours des 30 derniers jours)
I'm working to adapt an old version of code to new data so that I can have a more streamlined method of analyzing the data I get from a plate reader.
I'm currently going through my old code from top to bottom and editing and troubleshooting as I go.
For some reason I am getting the error message "The expression to the left of the equals sign is not a valid target for an assignment"on every assignment (example line 17 and 18).
I'm not new to MatLab but I must be missing something obvious because I've never had issues before.
Below is my code (not I've only edits to like 18 so the following lines might have variables I don't use etc.) You'll also notice I call another fuction in the code so I've addde that function's code below my actual function code in case it's helpful for troubleshooting.
function GeneralAnalysis
%For 96 well or 384 well plates
%need to enter file name as string in purple
filename='MTT Calibration';
newfilename= strcat(filename,' formatted');
dataname = '3-10'; % User input
%Read data
[data,words]=xlsread(filename);
FileName,NumConditions,WellsDescription,WellConditions,BackgroundWells,FileName = ImportDataDescription(dataname)
% First plot everything to look for contamination/outliers
% Plot blanks
blankwells = ['F2','F3','F4','F5','F6','F7','F8','F9','F10';
b = find(strcmp(blankwells,wellnames),1);
wellnames={'Time','',wellnames{:}};
tpn=0; %Initialize: number of time points in data set
rows=0; %Initialize: rows on plate
empty=0; %Keeps track of once you've gone thorugh all the rows once
idx = find(ismember(words, 'Plate:')); % Find where the data starts
time = exractNonNaNArray(data(idx+3:end,1));
formatteddata=zeros(length(time)+1,98);
time=time*60*24;
formatteddata(2:end,1)=time;
for t=1:length(time)
formatteddata(t+1,1) = time(t);
for row=1:8
for col=1:12
formatteddata(t+1,col+2+(row*10-10)) = data(((idx+2)+(t*9)-(10-row)),2+col);
end
end
end
% Convert wellnames from a cell array to an array of strings
wellnames=string(wellnames);
fid = fopen(strcat(newfilename,'.csv'),'w');
fprintf(fid,'%s,',wellnames');
fprintf(fid,[repmat('%f,', 1, size(formatteddata, 2)) '\n'],formatteddata');
fclose(fid);
end
function FileName,NumConditions,WellsDescription,WellConditions,BackgroundWells,FileName = ImportDataDescription(dataname)
%%Import information about each run using formated Excel sheet
[~,~,AllDataDescriptions] = xlsread ('DataDescriptions.xls'); % Imported by cell, so strings are cell strings use {} not []
% Find file name
[~, DataCol] = find(strcmp(dataname,AllDataDescriptions),1); % Returns a matrix where the first column is the row and the second column is the corresponding column
% Imports all formatted information
NumConditions = AllDataDescriptions{2,DataCol}; % Number of types of wells
BackgroundWells = strsplit(AllDataDescriptions{3,DataCol},','); % 1xN matrix listing the wells that are Background
WellConditions = strsplit(AllDataDescriptions{4,DataCol},';'); %1xN Matrix containg the list of wells with different types
FileName = AllDataDescriptions{1,DataCol};
% loop to sperate types of wells so each row is a different type and the
% columns after 1 are the wells
for i = 1:length(NumConditions)
WellsDescription(i,:) = strsplit(WellConditions{i},',');
end
end
Thank you in advance for any help!
  1 commentaire
Jan
Jan le 12 Mar 2017
Please do not let us guess, which lines are the 17th and 18th, when you have this important information already.

Connectez-vous pour commenter.

Réponse acceptée

Jan
Jan le 12 Mar 2017
Modifié(e) : Jan le 12 Mar 2017
The line 15 (perhaps) contains an error already:
blankwells = ['F2','F3','F4','F5','F6','F7','F8','F9','F10';
The closing square bracket is missing. Fix this at first an then find out, if the other errors remain.
Please note, that this line produces the same as:
blankwells = 'F2F3F4F5F6F7F8F9F10';
I doubt whether this is useful. Depending on what wellnames is, you might want a cell string perhaps:
blankwells = {'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10'};
This line is not valid also:
FileName,NumConditions,WellsDescription,WellConditions,BackgroundWells,FileName = ImportDataDescription(dataname)
Better:
[FileName, NumConditions, WellsDescription, WellConditions, ...
BackgroundWells, FileName] = ImportDataDescription(dataname);
  1 commentaire
Kristen Eller
Kristen Eller le 12 Mar 2017
Thank you so much. I knew it was something ridiculously silly but I just could not see it myself. It's been a long day but thank you so much for the help on such a small problem

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur File Operations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by